1 回答
TA贡献1865条经验 获得超7个赞
您的数据是 numpy 数组,您必须为 fit() 方法提供两个单独的参数,np.arrays 列表作为输入,np.array 作为标签。(删除元组作为输入):
First_inputs = Input(shape=(2000, ),name="first")
Second_inputs = Input(shape=(4, ),name="second")
embedding_layer = Embedding(3,3, input_length=2000,)(First_inputs)
flatten = Flatten()(embedding_layer)
first_dense = Dense(neuronCount,kernel_initializer=initializer, )(flatten)
merge = concatenate([first_dense, Second_inputs])
drop = Dropout(dropout)(merge)
output = Dense(1, )(drop)
model = Model(inputs=[First_inputs, Second_inputs], outputs=output)
x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.1,shuffle=True,
random_state=42)
First_inputs =x_train[:,0:2000]
Second_inputs =x_train[:,2000:2004]
model.fit([First_inputs, Second_inputs], y_train,validation_data=([First_inputs,
Second_inputs], y_train),verbose=1,epochs=100,steps_per_epoch=209)
添加回答
举报