【发布时间】:2021-02-07 23:51:02
【问题描述】:
我正在学习课程——来自 Kaggle.com 的深度学习简介。当我运行代码时
early_stopping = keras.callbacks.EarlyStopping(
patience=10,
min_delta=0.001,
restore_best_weights=True,
)
history = model.fit(
X_train, y_train,
validation_data=(X_valid, y_valid),
batch_size=512,
epochs=1000,
callbacks=[early_stopping],
verbose=0, # hide the output because we have so many epochs
)
我收到此错误。
Error when checking input: expected dense_3_input to have shape (33,) but got array with shape (34,)
full code。请帮我解释错误。在此先感谢:)
【问题讨论】:
-
请附上型号的代码。
-
你的 X_train、y_train、X_valid 和 y_valid 的大小是多少?
-
我看了你提到的链接。看起来数据集确实有 34 个特征,并且输出是二进制的。所以也许他们犯了一个错误,
input_shape应该等于34 -
现在可以使用了。数据集中有一个空特征。我没有放下它。在不删除它的情况下,input_shape 应该是 34,因为数据集中有 34 个特征。现在,通过删除空功能,一切正常。谢谢。
标签: python tensorflow keras deep-learning