Reputation: 41
So I am working on a multiclass problem with 6 outcome classes. I am using a OneVsRest classifier and trying to retrieve the prediction probabilties for every class using .predict_proba.
I was expecting the sum of the prediction probabilities of all classes for every observation to come out as one, however that is not the case.
predictor = OneVsRestClassifier(xgb.XGBClassifier)
predictor.fit(X_train, y_train)
y_pred = predictor.predict_proba(X_test)
print(y_pred[1])
My output is: [0.11484083 0.02525082 0.02969465 0.58868223 0.09889702 0.03193117]
Can that be correct?
Upvotes: 0
Views: 577
Reputation: 537
From the document of OneVsRestClassifier, this strategy consists in fitting one classifier per class. For each classifier, the class is fitted against all the other classes.
. For example, if you want to classify dog, cat, and bird with OneVsRestClassifier, it will train 3 models.
Three models will be trained independently as a binary-class classification. So, the probability from three models do not sum up to 1.
Upvotes: 2