[英]Keras LSTM Shape for Pandas DataFrame
我在玩机器学习,并尝试跟随一些示例,但一直试图将我的数据放入Keras LSTM层。
我在Pandas DataFrame中有一些股票行情自动收录器数据,每隔15分钟用ohlc和每行其他指标的负载重新采样一次。
我的代码如下。 df是我的DataFrame:
x = df.iloc[:, :-1].values
y = df.iloc[:, -1:].values
dimof_input = x.shape[1]
dimof_output = len(set(y.flat))
model = Sequential()
model.add(LSTM(4, input_dim=dimof_input, return_sequences=True))
model.compile(loss='mse', optimizer='rmsprop')
model.fit(x, y, nb_epoch=1, batch_size=1, verbose=2)
当我尝试并适应时,我得到:
Error when checking input: expected lstm_16_input to have 3 dimensions,
but got array with shape (33, 100)
我已经从其他地方的示例中复制了此内容。 我不太清楚如何在此模型中获得正确的数据形状。 有人可以帮忙吗?
感谢负载。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.