I am tasked with a project that aims to predict the probability of a product being returned before the product is even ordered.

I have an excel containing a bunch of orders. In order to make predictions, it is important to predict each item in the context of the order basket, e.g. if a person orders 5 pairs of shoes, he will most likely be returning 4 of the 5 pairs.

I can link purchases of different products via their order ID. Question is, how am I supposed to preprocess these IDs to preserve their relationship. Do I just encode them like a categorical attribute?


1 Answer 1


Yes. There are 2 options for encoding order:

  • One Hot Encoding : Useful when we want to treat distinct values of OrderID as features. Since order ID does not mean anything. This encoding is not recommended.
  • Simple Numerical Encoding like 1,2 ,3 : This will remove any meaning in orderID. But we are not concerned about that. So this method is suitable.

Now, problem comes in selecting model. The order ID has association with other features such as item category. For eg: If there are 4 shoes in same order_id, then chances of return are high. You can not use logistic classification model here:

  • features should not be correlated
  • features should be linearly related to independent variable

Classifiers that do not have above limitations are : Decision Tree, Random Forest. Start with Decision Tree with Pruning and then to RF. We can discuss modelling part later.


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.