Reputation: 4412
I am using the MLPClassifier using the lbfgs solver.
If I calculate the expected value using the predict_proba() method and the classes_ attribute, it does not match what the predict() method returns.
Which one is more accurate?
Does the value returned by predict() have to be one of the classes? Will it not interpolate between the classes? I have a continuously varying variable I want to predict.
Upvotes: 0
Views: 748
Reputation: 117
Definition
predict
- classifies your input into a label.
predict_proba
- returns the predicted probability for each class in your model.
Example
If this were a binary problem, and your classes labelled 0
and 1
. Then for some input you are testing, predict
will return a class, let's say 1
.
However, predict_proba
is going to give you the predicted probability that this input maps to class 1
, which could, in this example, be 0.8
. This is why their values do not match.
Which is more accurate?
You can't really compare their accuracy. However, you can treat the predict_proba
as the confidence of your model for a particular class. For example, if you have three classes, and you tested one sample. Then you would receive an output of three real numbers:
[0.11, 0.01, 0.88]
You could treat this as your model having a high confidence that this input maps to the third class, as it has the highest probability of 0.88
.
In contrast, for some other input value, your model might spit out the following:
[0.33, 0.32, 0.34]
Your model still predicts the third class, as this has the highest probability. However, there is a low confidence that the third class is the true class.
Upvotes: 2