Rosella Machine Intelligence & Data Mining | ||||||||||||||||||||||||||||||||||||||||||
Time-series Analysis and Forecasting with Neural NetworkNeural network is a robust modeling tool. As an alternative approach to regression, neural network can be used to capture time-series trends and seasonal patterns. Note that regression is limited in terms of data used. Neural network can include various other related information. When used properly, neural network can improve predictive accuracy. Usage of time-series forecasting is diverse: economic modeling, sales trend analysis, revenue projections, etc. For example, the following neural network predicts "Amount" based on input of "Season No/Index" and "Season code";
Forecasting with Seasonal AdjustmentTime-series data often contain seasonal patterns. For example, clothing and fruits sales can fluctuate based on seasons. This hides underlying patterns and makes it difficult to project figures accurately. In neural network modeling, simply adding seasonal information will capture seasonal patterns. It is noted that forecasting with seasonal adjustment using regression requires at least 2 years of data, preferably 3 or more years of data. Neural network method can work with at least 1 year of data. Data Preparation for Seasonal ForecastingData preparation for neural network is simple. The following table shows an example of time series data. The first column in season index. They are sequential numbers. Numbers can start from any number. But must be consecutive numbers. This provides temporal information. The second column is for season names. Season names are categorical values. If data is monthly, then "S01", "S02", ... "S12" are recommended. Notice "0" for months less than 10. This will make it easier to sort season. If it is quarterly data, "S1", "S2", ... "S4", as shown in the table, are recommended. This information can be derived from season index numbers by simple rules as follows; CASE ((SeasonIndex - 1) % 4) WHEN = 0 THEN SET Season AS 'S1' WHEN = 1 THEN SET Season AS 'S2' WHEN = 2 THEN SET Season AS 'S3' WHEN = 3 THEN SET Season AS 'S4' END CASE ((SeasonIndex - 1) % 12) WHEN < 9 THEN SET Season AS 'S0' + ((SeasonIndex - 1) % 12 + 1) ELSE SET Season AS 'S' + ((SeasonIndex - 1) % 12 + 1) END The last column contains amount or quantity values. You may add more information, if available and has strong relevancy. This can further enhance predictive accuracy. Three years or more of data is need for accuracy. At least two years recommended.
Neural Network vs RegressionThe following is an Excel screenshot that shows performances of Neural Network Models vs Time-series Regression with Seasonal Adjustment, using the above data. Correct next series values are shown at the first "Correct values" column. Green cells show predicted values by neural network model and time-series model respectively. Yellow cells show error ratio percentage. Three neural network models are used. Predicted values are averaged. In general, neural network can be more accurate than regression.
The following is an Excel plot showing gradual increase with seasonal patterns. Brown line is from time-series data. Blue line is from neural network predictions.
Free Download: CMSR Data Miner / Machine Learning / Rule Engine StudioCMSR Studio provides powerful neural network modeling tools. For tutorial information, watch CMSR YouTube Videos. Neural Network Configuration and TrainingFrom CMSR Studio neural network modeling tool, use the first two columns "Season Index" and "Season Name" as input/induction variables. Note that "Season Index" is a numerical field and need to configure as a numerical field. Make sure "Season index"'s maximum value is large enough to cover entire expected predicting range. Use the amount field as the target prediction variable. Then train with your data. For more details, please watch the following YouTube video; Implanting Neural Network Model into ExcelOpen your neural network model. From "Modeling" menu, select "Export model as program code". Choose "Language" as "VBA(Excel)" and other information. Then press the "Copy" button. An Excel macro function code for neural network will be stored on your system clipboard. From Excel, open macro editor. Paste your system clipboard content into a module. Then you are ready to use as Formula! To get VBA macro edit windows, press (FN)+ALT+F11 at the same time. Then macro editor will appear. To create a module, right click your project. Then choose "Insert" and "Module". Then a module will appear. Paste the code into it and close. The followings are formula coding examples. If you used different function names, change accordingly. Note that "A" column holds "Season Index", "B" column holds "Season Name". =cmsrmodel(A1,B1) =cmsrmodel(A1:B1) =cmsrmodel(A1:A2) // vertically arranged data =(cmsrmodel1(A4, B4)+cmsrmodel2(A4, B4))/2.0 // two model examples =(cmsrmodel1(A5, B5)+cmsrmodel2(A5, B5)+cmsrmodel3(A5, B5))/3.0 |
||||||||||||||||||||||||||||||||||||||||||