1
$\begingroup$

I have a dataset of monthly sales for the past 6 years. Significant attributes in the data set are:

Region,  Nameplate,  Segment  MonthofSale and TotalSales.

I want to experiment with using neural networks for forecasting sales in R for the next 3 months. Using the Last 2 years as Validation data and the previous 4 years as Training.

If I were to do that, do I consider Region, Nameplate, Segment and MonthofSale as Inputs?

And do a 4 -3-1 network? Or did I get the whole concepts of inputs wrong?

Any pointers on this will greatly be appreciated. Thanks & Regards, B

$\endgroup$
  • $\begingroup$ You might want to check out Kaggle.com's recent Wikipedia Web Traffic Time Series Forecasting competition, as the contest has ended and many top competitors have posted their solutions. The second place solution used a feedforward neural net with inputs like the ones you described, as well as day of the week, etc.. The 1st place solution used a sequence-to-sequence net. $\endgroup$ – Ben Ogorek Dec 11 '17 at 5:33
2
$\begingroup$

To expand on Kilian's answer:

  • Categorical variables have different implications if meant to be inputs or targets. I your case, they are inputs. Apart from the encoding method, you may want to be careful that the (continuous) output is not heavily influenced by them (i.e. a strong change in a categorical input may lead to a bump in the output).

  • The number of hidden units is a difficult task. For testing, go with the architecture you have (4-3-1), although I'd rather tend to something like 4-9-1... In any case, if you want to optimize, you need to iterate and try different hidden layer's sizes. A recommendation is to start with 1 or 2 nodes and iterate upwards, then graph your results and see if there's a point where more nodes do not help anymore.

  • In many time series forecasting problems you want to include previous information. Consider adding the previous' months sales information in some form. Of course you'd have more inputs nodes then. If there are no recurrent neural networks available, you can incorporate this information in normal MLP as normal inputs.

  • Have in mind that the results change in every run, since (most commonly) the weights are randomly(!) initialized, thus (potentially) leading to different results. You can check this easily: Train, train again and compare the results. This can give you a hint about the goodness of other parameters.

$\endgroup$
0
$\begingroup$

Generally, you can do that. Things to consider:

  • One input always means just one numeric input value. So with four input variables, you can only use one sample of your dataset (for example the last month) to predict the next month.
  • Your attributes contain categorical attributes. Consider encoding them in a One-Hot vector.
  • In a 4-3-1 network, you only have one numeric output value. That is fine, if you want to output the total sales. If you want to predict multiple attributes or a categorical one, you should have multiple output neurons as well and use one-hot encoding for the categorical attributes.
  • It might make sense to consider multiple months for the prediction (let's say the last 5 months). You can let the network use the data of multiple months by either increasing the number of input values and feeding the data directly or by using a Recurrent Neural Network, preferably a LSTM network. However, I don't know, if R has a library for LSTM networks.
$\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.