Keras:期望dense_1_input具有形状(8,)但是具有形状的数组(5,)

时间:2018-04-12 19:02:23

标签: python keras classification

尝试在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)

0 个答案:

没有答案