定义模型培训期间的输入,TensorFlow中的功能API

定义模型培训期间的输入,TensorFlow中的功能API,tensorflow,keras,Tensorflow,Keras,我正在尝试使用TensorFlow()中的函数API来构建一个深度学习模型。这是我的模型: first_inputs = Input(shape=(100, )) first_dense = Dense(1, )(first_inputs) second_input = Input(shape=(1, )) merge = concatenate([first_dense, second_input]) output = Dense(1, )(merge) model = Model(input

我正在尝试使用TensorFlow()中的函数API来构建一个深度学习模型。这是我的模型:

first_inputs = Input(shape=(100, ))
first_dense = Dense(1, )(first_inputs)
second_input = Input(shape=(1, ))
merge = concatenate([first_dense, second_input])
output = Dense(1, )(merge)
model = Model(inputs=[first_inputs, second_input], outputs=output)
model.compile(optimizer=ada_grad, loss='binary_crossentropy',
           metrics=['accuracy'])
如您所见,我使用train_test_split:

x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.01, random_state=42)

我如何使用model.fit来表示第一个输入和第二个输入是x列中的这些列?如何使用模型。评估并说第一个输入和第二个输入是x列中的这些列?

你不能这么说。应将多个输入作为数组列表呈现给
fit
。例如:

X = np.random.randn(1234, 101)
X1, X2 = X[:,:100], X[:, 100]
Y = np.random.randn(1234, 1)
model.fit([X1, X2], Y)