1
$\begingroup$

I am trying to predict future sales from past transactional data with a neural network. My data looks something like this:

Customer, Transaction_Num, Sales, Product, Date, ... About 50 more categorical variables

I would like the network to learn from these transactional rows and predict next week's sales.

The best way I can think of to structure this data is to sum up all data for each week and put it in a column, like so:

Week t Sales, Week t-1 Sales, Week t-2 Sales, etc for all 50+ variables * # of weeks

And for a lot of the variables it wouldn't make sense to sum or average them.

Is there a better way of doing this?

$\endgroup$
3
$\begingroup$

The data that you have available is temporal data. Because of that there are two choices you can make.

Either you use a window for your temporal data, and compute statistics over this window, say the mean, std deviation, etc. You can then update your model by shifting the time-window to the end of the period after every week.

A more natural approach however would be to use a recurrent neural network, which is capable of processing arbitrary length time-sequences. At every time-step t you feed in the values of your features for that date, and make a prediction for the sales.

You can then train the model by back-propagating through time the error between the prediction at time-step t and the actual sales at that time-step. For training I would use a fixed length time sequence of say T=20 (or as long as you deem that the variables will still have impact on future sales). You can obtain multiple training examples by sliding your window of T over your time series, and creating sub-time series of length T.

$\endgroup$
1
$\begingroup$

One way to do it is to perform a PCA and reduce the number of variables.

I am not an expert in neural nets, but picking out around 5 - 10 variables from PCA that explained 80%+ variance can already reduce the computational time by miles.

$\endgroup$

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.