我正在制作一个 MLP 模型,它需要两个输入并产生一个输出。
I have two input arrays (one for each input) and 1 output array. The neural network has 1 hidden layer with 2 neurons. Each array has 336 elements.
model0 = keras.Sequential([
keras.layers.Dense(2, input_dim=2, activation=keras.activations.sigmoid, use_bias=True),
keras.layers.Dense(1, activation=keras.activations.relu, use_bias=True),
])
# Compile the neural network #
model0.compile(
optimizer = keras.optimizers.RMSprop(lr=0.02,rho=0.9,epsilon=None,decay=0),
loss = 'mean_squared_error',
metrics=['accuracy']
)
Run Code Online (Sandbox Code Playgroud)
I tried two ways, both of them are giving errors.
model0.fit(numpy.array([array_1, array_2]),output, batch_size=16, epochs=100)
Run Code Online (Sandbox Code Playgroud)
ValueError: Error when checking input: expected dense_input to have …