Binary:logitraw, binary:hinge and predict_proba

Hi, I struggle to compute probabilities for an estimator with objective ‘binary:logitraw’ using the sklearn python wrapper. Calling predict_proba yields a Nx2 array with values ranging roughly from -4 to 4. Looking at https://en.wikipedia.org/wiki/Logit this matches the y-values of the logit. Computing inverse logit as in

q = estimator.predict_proba(X)
p = np.exp(q[:,0])/(1+np.exp(q[:,0]))

seems fine as all values in p are between zero and one. I assumed that computing the sum

r = np.exp(q[:,0])/(1+np.exp(q[:,0]))+np.exp(q[:,1])/(1+np.exp(q[:,1]))

would yield ones in each row of r but actually a good portion of values are somewhat above one (almost up to 1.25). So what is missing? Shouldn’t predict_proba yield probabilities? Besides this objective binary:hinge only yields 0 or 1. Can we compute probabilities for binary:hinge somehow?

1 Like