I have a data set like:

did_purchase  action_1_30d action_2_20d action_2_10d ....
   False            10          20            100
   True            ....etc

Where did_purchase shows whether the customer purchased or not, and the columns indicate the volume of actions taken before the purchase (or non-purchase) event.

So, for the first row the customer did 10 of action_1 within 30 days of the purchase event, but didn't purchase in the end.

I have been using sklearn's LogisticRegression to predict the did_purchase false/true, and can get about 89% accuracy, which is nice.

However, I'd like a percentage intent score instead. So it could say user-321 has a 46% chance of purchasing in the next 10 days.

What would be a good algo/approach for this?

  • $\begingroup$ You mention 89% accuracy. What is the distribution of class labels? Is there a class imbalance? If so, accuracy may not be the right metric here. $\endgroup$
    – Wes
    Feb 11, 2019 at 18:39
  • $\begingroup$ Sorry I meant F1 is 0.89. Class labels were imbalanced 1% Yes - 99% No but I SMOTE'd them $\endgroup$ Feb 11, 2019 at 18:43

1 Answer 1


You could use the probabilities output by LogisticRegressions predict_proba method.

Almost all classifiers give you a probability in sklearn. One exception is the support vector classifier which will give you a points distance to the decision hyperplane, which can be interpreted as a confidence (you can get probabilities for the support vector classifier, but it is through a computationally costly cross validation process).


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.