使用KerasWrapper时,我获得了很高的培训准确性:95%以上
X_train, X_test, y_train, y_test = train_test_split(train_data, train_labels, shuffle=True, test_size=0.3, random_state=42)
estimator = KerasClassifier(build_fn=build_model(130, 130, 20000), epochs=2, batch_size=128, verbose=1)
folds = KFold(n_splits=3, shuffle=True, random_state=128)
results = cross_val_score(estimator=estimator, X=X_train, y=y_train, cv=folds)
但是,我的预测准确性一点也不好。这是过度拟合的经典案例吗?
prediction = cross_val_predict(estimator=estimator, X=X_test, y=y_test, cv=folds)
metrics.accuracy_score(y_test_converted, prediction)
# accuracy is 0.03%
如何提高测试准确性?谢谢
这是过拟合的经典案例吗?