我尝试使用validation_data
方法,但遇到问题
model.fit([X['macd_train'], X['rsi_train'],X['ema_train']],
Y['train'],
sample_weight=sample_weight,
validation_data=([X['macd_valid'],
X['rsi_valid'],
X['ema_valid']],
Y['valid']),
epochs=nb_epochs,
batch_size=512,
verbose=True,
callbacks=callbacks)
我收到错误:
ValueError: The model expects 3 arrays, but only received one array. Found: array with shape (127, 100, 8)
如果我使用validation_data=None
这是我的变量信息
X['macd_train'].shape, X['macd_valid'].shape
(507, 100, 2), (127, 100, 2)
X['rsi_train'].shape, X['rsi_valid'].shape
(507, 100, 1), (127, 100, 1)
X['ema_train'].shape, X['ema_valid'].shape
(507, 100, 6), (127, 100, 6)
Y['train'].shape, Y['valid'].shape
(507, 1), (127, 1)
答案 0 :(得分:1)
model.fit()
将数据输入作为第一个参数,将第二个参数作为数据输出。您尝试使用[X['macd_train'], X['rsi_train'], X['ema_train']]
但是,您没有连接数据,只是增加了数组的维度。您应该使用numpy.concatenate()
来控制正确的轴上的连接。