I'm practicing my machinelearning / sklearn skills with a kaggle playground and I'm having trouble why a suggested change made by a fellow user yields better results.
The challenge involves binary classification and the results are ranked by their roc_auc
score.
I created a classifier (clf
) using LogisticRegression and made the predictions with the following line of code
predictions = clf.predict(X)
This method resulted in a score of 0.68.
A fellow user suggested that I instead used the following method:
predictions = clf.predict_proba(X)[:,1]
This did indeed result in a higher score (0.76), but I'm having trouble understanding why.
As I understand it, the predict
method takes the highest scoring class of the predict_proba
as its output and thus the score between both examples should be the same.
e.g:
prob_0 | prob_1 | predict
0.3 0.7 1
0.51 0.49 0
The higher score of the predict_proba
method indicates that my understanding of these methods is flawed, but I'm not sure what I'm getting wrong here. Could anyone help point me in the right direction?