尝试在Keras中执行以下二进制分类代码时收到错误消息
“检查输入时出错:期望的dense_1_input具有形状(8,)但是得到了具有形状(5,)的数组”。我已指定input_dim = 5.不确定我缺少什么。真的很感激任何帮助!
X_Train dataframe shape =(116020,5)
Y_Train dataframe shape =(116020,)
我的代码:
model.add(Dense(12,input_dim = 5, activation='relu'))
model.add(Dense(15, activation='relu'))
model.add(Dense(8, activation='relu'))
model.add(Dense(10, activation='relu'))
model.add(Dense(1, activation='sigmoid'))
model.compile(loss="binary_crossentropy", optimizer = "adam", metrics = ['accuracy'])
model.fit(X_train,Y_train, epochs = 1000, batch_size = 10)