[英]keras validation_data with multiple input
I try to use validation_data
method, but have a problem 我尝试使用
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)
I get an error : 我收到一个错误:
ValueError: The model expects 3 arrays, but only received one array. Found: array with shape (127, 100, 8)
My code can run properly if I use validation_data=None
如果我使用
validation_data=None
我的代码可以正常运行
Here is my variables information 这是我的变量信息
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)
model.fit()
takes as first argument the data input and as the second one the data output. model.fit()
将数据输入作为第一个参数,将数据输出作为第二个参数。 You attempt to do that by using [X['macd_train'], X['rsi_train'], X['ema_train']]
你试图通过使用
[X['macd_train'], X['rsi_train'], X['ema_train']]
来做到这一点
However, you are not concatenating your data but only increasing the dimension of your array. 但是,您不是连接数据,而只是增加数组的维度。 You should use the
numpy.concatenate()
to have control over your concatenation over the proper axis. 您应该使用
numpy.concatenate()
来控制正确轴上的串联。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.