I work for an e-commerce company and I would like to create a model that classifies customers as returning customers and not returning customers. We are in the domain of supervised learning.

The problem is that all variables (but maybe the price/average price of the items bought and the days passed between order and delivery) are categorical values. These can be the product category, the website on which the purchase was made, the carrier that delivered the item, the area in which the customer lives, payment method, etc.

Do you think that with this set of data it is possible to predict whether or not a customer will make purchase again?

  • 1
    $\begingroup$ You might want to use random forests, it works with categorical and continuous variables. $\endgroup$
    – Simone
    Commented Mar 21, 2016 at 2:55
  • $\begingroup$ How do you define "a returning customer"? Could it be an alternative to model the expected waiting time before he returns? Do you have data which is labelled with return/no return? $\endgroup$ Commented Feb 20, 2017 at 16:30

1 Answer 1


One way to deal with categorical variable is to encode them using one-hot encoding, as described n sklearn preprocessing

However, if the number of categorical variables is too high, you would run into memory issue, then more modification is needed. Encoding is the conventional approach


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.