ValueError:检查输入时出错:预期density_10_input具有形状(11,)但具有形状(83,)的数组

时间:2019-11-28 18:02:08

标签: python tensorflow keras

我有以下代码。我有4个要素数据和一个标签。我想使用特征数据来预测标签。运行代码,在

行给我一个错误
classifier.fit(X_train, y_train, batch_size = 10, epochs = 100)




from tensorflow.python.keras.layers import Dense
from tensorflow.python.keras import Sequential

#classifier=tf.keras.Sequential()
classifier = Sequential()

classifier.add(Dense(3, kernel_initializer = 'uniform', activation = 'relu', input_shape = (4,)))
classifier.add(Dense(3, kernel_initializer = 'uniform', activation = 'relu'))
classifier.add(Dense(1, kernel_initializer = 'uniform', activation = 'sigmoid'))
classifier.compile(optimizer = 'adam', loss = 'binary_crossentropy', metrics = ['accuracy'])
classifier.fit(X_train, y_train, batch_size = 10, epochs = 100)

ValueError: Error when checking input: expected dense_10_input to have shape (11,) but got array with shape (83,)

0 个答案:

没有答案