0
$\begingroup$

I had some old code used to train a Random Forest Classifier (sklearn 0.17.1), for classification on two classes (spam/ham). I ran this in a docker container and sent it some data.

Sklearns predict_proba returns [0.3, 0.7].

I “rewrote” (literally changed a few lines for Python3 compatibility), trained with the same data, and sent it the same data, and now predict_proba returns [0.7, 0.3].

Did something change in sklearn.ensemble.RandomForestClassifier predict_proba or have I messed up somewhere, or does the new one still work?

$\endgroup$
  • 1
    $\begingroup$ Could you share a code that reproduces your error ? $\endgroup$ – Robin Nicole Apr 11 '19 at 20:02
  • $\begingroup$ My first guess would be that the way spam/ham get encoded changed. You should be able to call classes_ to check. $\endgroup$ – Ben Reiniger Apr 18 '19 at 2:31
0
$\begingroup$

Maybe... Have a you seen if one of the predict_proba produces 2 columns?

I think Python 3 produces two columns and the one comparable is the second.

|improve this answer|||||
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.