0
$\begingroup$

I am training an xgboost model for binary classification using objective as 'binary:logistic'. The model should predict probability but it is outputting either 0 or 1. I want the model to output the probability. These are the parameters I am using enter image description here Thanks a lot in advance!

$\endgroup$
3
  • 2
    $\begingroup$ How are you getting the predictions from your model? It is likely that the default predict method automatically converts the probability to a 0/1 prediction, and that there's a separate method to get the underlying probability (e.g. see the predict and predict_proba methods for the LogisticRegression in scikit-learn. $\endgroup$
    – Oxbowerce
    Commented Aug 6, 2023 at 14:12
  • $\begingroup$ Thanks @Oxbowerce . Using predict_proba instead of predict worked. $\endgroup$
    – shivani
    Commented Aug 6, 2023 at 17:41
  • $\begingroup$ Added my comment as an answer so you can accept it as an answer to mark this question as answered. $\endgroup$
    – Oxbowerce
    Commented Aug 6, 2023 at 18:15

1 Answer 1

1
$\begingroup$

How are you getting the predictions from your model? It is likely that the default predict method automatically converts the probability to a 0/1 prediction, and that there's a separate method to get the underlying probability (e.g. see the predict and predict_proba methods for the LogisticRegression in scikit-learn).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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