orlandpm / Math-for-Programmers

Source code for the book, Math for Programmers
840 stars 391 forks source link

16.4.3 Exercises: error raised with MLPClassifier predict method #14

Open dereckdamphouse opened 3 years ago

dereckdamphouse commented 3 years ago

Seems like mlp._predict may be deprecated(?), as the following error is raised when running 16.4.3 (scikit-learn v0.24.2):

AttributeError Traceback (most recent call last)

in ----> 1 mlp._predict(x)[0] AttributeError: 'MLPClassifier' object has no attribute '_predict'

From scikit-learn, seems like the method to use is predict_proba(x).

So, mlp.predict_proba(x)[0] seems to work correctly.

scikit-learn source