0
$\begingroup$

Let's say I have to predict the total monthly sales of a store. I have the data in the following format:

enter image description here I don't think I can use this data directly for predicting the sales for a month, as in it's current form there is no target variable present to predict. We would have to sum the sales for each month and only then will we get our target variable (the sales that we want to predict).

Please see when I group the sales by month (Jan and Feb):

enter image description here

Now the above is data I can use with ml algos to predict the Total_Sale which is my target variable. But, since now I have grouped the sale by month, I have lost all the features like Gender, Age, Product etc... I cannot explain these features and see their impact on the sale.

Is there any way around this?

Thanks

$\endgroup$
  • $\begingroup$ How much data you have - from what time to what time? $\endgroup$ – Ankit Seth Jul 10 '18 at 8:09
  • $\begingroup$ @AnkitSeth, there are around 4 million records total, the data is from Jan 2013 to Jun 2018. Data is received monthly, and there are multiple sales per day. $\endgroup$ – Ali Jul 10 '18 at 9:48
1
$\begingroup$

You can pass the entire month's data as a single sample, which should predict the sales of that month. It would look like an index with multiple indexes. Something like MultiIndex in python's Pandas library.

Another idea would be to still try predicting the sales every day, then just sum up all predictions at the end to create your monthly aggregation.

Using something like a neural network may be overkill - it depends how much data you have - but will offer the flexibility to easily train a model with multiple inputs and a single output, as is your case.

| improve this answer | |
$\endgroup$
  • $\begingroup$ n1k3t14, regarding your second idea, there are still multiple orders for one day so I would still need to aggregate, so I have the same problem. I would look into MultiIndex, however, could you please give me some pointers on how to shape my data to be used in a neural network (I have a lot of data)? $\endgroup$ – Ali Jul 10 '18 at 6:56
  • $\begingroup$ What is the current format of your data and which language are you using? You can add those a tags to your question :) $\endgroup$ – n1k31t4 Jul 10 '18 at 7:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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