
scikit-learnのStackingClassifierでKerasClassifierを使った時に表題のエラー。
ValueError: The estimator KerasClassifier should be a classifier.sklearnのモデルには、classifierやregressorなどを指定する属性として_estimator_typeを持っている。
This distinction between classifiers and regressors is implemented using the
https://scikit-learn.org/stable/developers/develop.html_estimator_typeattribute, which takes a string value. It should be"classifier"for classifiers and"regressor"for regressors and"clusterer"for clustering methods, to work as expected.
そのため、KerasClassifierに対して明示的にclassifierであることを示せばOK。
nn = KerasClassifier()
nn._estimator_type = "classifier"参考



コメント