0
$\begingroup$

I have a data from a store for the products that sold since more than 5 years. Each sell process has a customer id, date, and the quantity of the product.

I want to build a machine learning model to predict the products that will be sold in the next day/s for each of the customers, giving that I have N products (~2k) and M customers (~50).

I am not able to formulate this problem. It's a regression task (probably), but I don't know how can I formulate it to predict the products that a given customer will buy.

Since we have N products, this doesn't mean that a customer will buy all of them; x customer might buy only 5 products in the next day.

$\endgroup$
2
  • $\begingroup$ you can use MLforecast package. github.com/Akai01/MLforecast $\endgroup$ Commented Aug 5, 2020 at 6:46
  • $\begingroup$ @Econ_matrix not clear what is this, and there is no resources for it. $\endgroup$
    – Minions
    Commented Aug 12, 2020 at 17:15

2 Answers 2

1
$\begingroup$

Typically in a sales forecast task you will use data structured like the following:

date      | customer_ID | product_ID | quantity_sold 
----------------------------------------------------
2022-09-22| 1           | 1          | 10            
2022-09-22| 1           | 2          | 20            
2022-09-22| 2           | 1          | 10     
2022-09-22| 2           | 3          | 50     
...

So yes, you can frame this as a regression task where you predict the sales (either quantity or value) per customer, product and date. It makes usually sense to aggregate your data on the level which is desired for your forecast (in your case this means to stick with sales per customer per product per day but if your forecast only needs to be on a weekly level, for example, you could and probably should aggregate your data on a weekly level too).

To better understand your task and potential approaches I suggest you have a look at sales prediction tasks such as Kaggle M5 Forecasting - Accuracy which is very similar.

In my experience, gradient boosted decision trees often provide very good results for tasks as these. However, the key thing will be feature engineering, e.g. introduced lagged features. Again, the M5 Kaggle competition I linked above (or similar forecasting competitions) can provide many ideas how to tackle this.

$\endgroup$
0
$\begingroup$

To answer your question, in that dataset the first thing to do is to determine the types of products in that product sold column or whatever. If you have like 3 or more different kinds of products to be sold. Then you can rename those types and use a classifier algorithm to make your prediction. So the product sold will serve as your target variable and other closely correlated variables will now serve as your predicting variables. So to add to the above, you want to predict the number of products to be purchased by a customer, then I suggest you look out for good multi-target regression models.

$\endgroup$
1
  • $\begingroup$ Sorry you answer is not clear. What do you mean by: 1) rename thoese types and use a classifier? 2) the product sold will serve as your target variable? , 3) other closely correlated variables will now serve as your predicting variables? Could u plz clarify these points? $\endgroup$
    – Minions
    Commented Aug 12, 2020 at 17:14

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.