I want to predict whether the client will renew his/her subscription based on groceries consumption patterns. Suppose an order contain only one type of grocery.

I have a DataFrame containing ratios of values for different types of groceries for each client and the total number of orders. Each ratio represents the number of groceries of a specific type divided by the total number of groceries ordered. However, the reliability of these ratios varies based on the total number of orders.

For example, if a client has only placed one order of a particular type, the ratio for that type will be 100%. However, if another client has placed 97 orders of the same type with 100 orders in total, the ratio would be 0.97%.

Client ID Total Orders Type A Ratio Type B Ratio Type C Ratio
0 1 1.00 0.00 0.00
1 100 0.97 0.01 0.02
2 5 0.60 0.20 0.10
3 10 0.30 0.50 0.20
4 50 0.80 0.20 0.00

I am training a machine learning model using XGBoost, but I am struggling to capture the relationship between the ratios and the total number of groceries to weight reliability of ratios. It appears that the model is not effectively learning this relational information. Client 1 ratio on type A groceries is more reliable than client 0 but a model appears to only see that the ratio for Client 0 is larger than Client 1.

I would appreciate any suggestions on how to address this issue. How can I incorporate the varying reliability of the ratios into my machine learning model? Are there any techniques or approaches that can help the model learn the importance of different ratios based on their reliability?

Thank you in advance for your assistance!

  • $\begingroup$ Can you provide a sample of your dataset (a few rows at least) $\endgroup$ May 26 at 11:31

1 Answer 1


So, your independent variables are:

  • total number of customer orders
  • ration of specific product to total amount of orders

And you independent variable is:

  • how reliable is the ratio (in percent?)

If you want to use machine learning to solve this problem you need a labeled dataset which would provide a sufficient training data, so the algorithm or neural network could capture the pattern. Labeled means, that it already must contain both independent and dependent variables.

If you do not have such a dataset, and instead you only have total number of customer orders and ration of specific product to total amount of orders than I do not think that a machine learning model can capture a relation, because, well, it does not exist. Total number of orders does not determine the ratios in any way.

Instead, you can just create a mathematical formula which would output a higher reliability number if the total amount of orders is higher and then test if the given results suits your task.

  • $\begingroup$ Thank you for your answer, I did update my question because there could be some misunderstandings, can you please check whether your answer still fit ? $\endgroup$ May 25 at 14:59

Your Answer

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

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