Skip to content Skip to sidebar Skip to footer

Attributeerror: 'mlpclassifier' Object Has No Attribute 'decision_function'

I do not know why I'm getting that error while I'm trying to use decision_function() model_1 = BaggingClassifier(base_estimator=MLPClassifier()) model_1.fit(Xtrain, ytrain) model_1

Solution 1:

Although BaggingClassifier does have the decision_function method, it would only work if the base_estimator selected also supports that method; MLPClassifier does not. Some models like SVM and logistic regression, which form hyperplanes, on the other hand, do. If you are interested in the confidence in predictions, you may consider the predict_proba method as a related measure; they are not at all the same though (1, 2).


Post a Comment for "Attributeerror: 'mlpclassifier' Object Has No Attribute 'decision_function'"