User Guide For 4Cast XL ( back )


Help contents:

1.   Introduction

2.   Preparing Data

3.   Getting Started

4.   Testing And Predicting

5.   Advanced Issues

6.   System requirements

7.   Example 1 (predicting the DJIA weekly price)

8.   Example 2 (Sales Forecasting)


1. Introduction

Everyone try to forecast the future. Bankers need to predict  credit worthiness of customers. Marketing analyst want to predict future sales. Economists want to predict economic cycles. And everybody want to know whether the stock market will be up or down tomorrow.

Over the years, many software have been developed for this purpose and one such software is the neural network based application. Neural networks “learn” by using examples. Using this examples will be trained to develop a formula or model for solving a given problem.

Each neural network software has its own proprietary version of various data mining algorithm.

4Cast XL is developed with a user-friendly interface and easy to use. It is also embedded as an addin in MS Excel making it powerful and reliable. Anyone who can use MS Excel for data manipulation and analysis will find 4Cast XL easy to master. Its limitation is bounded only by MS Excel capabilities. These includes data processing, graphing, calculation and so on.

Since the beginning of the new millennium, we have witnessed neural networks come of age. Artificial neural network is an information processing paradigm whose architecture is modeled after the brain. Neural networks don't do anything that can't be done by traditional computing techniques and they can readily do some tasks that would otherwise be very difficult. They have proven themselves to be a valuable tool across a wide range of functional areas affecting most businesses.

They typically consist of many hundreds of simple processing units which are wired together in a complex communication network. Each unit or node is a simplified model of a real neuron which fires (sends off a new signal) if it receives a sufficiently strong input signal from the other nodes to which it is connected. The strength of these connections may be varied in order for the network to perform different tasks corresponding to different patterns of node firing activity. This structure is very different from traditional computers.

Neural networks are useful when lots of examples must be analyzed, or when a structure in these data must be analyzed but a single algorithmic solution would be too difficult to formulate. When these conditions are present, neural networks are use as computational tools for examining data and developing models that help to identify interesting patterns or structures in the data. The data used to develop these models is known as training data. Once a neural network has been exposed to the training data, and has learned the patterns that exist in that data, it can be applied to new data thereby achieving a variety of outcomes. Neural networks can be used to

learn to predict future events based on the patterns that have been observed in the historical training data;

learn to classify unseen data into pre-defined groups based on characteristics observed in the training data;

learn to cluster the training data into natural groups based on the similarity of characteristics in the training data.

While there are many different neural network models that have been developed over the last fifty years or so to achieve these tasks of prediction, classification, and clustering, our company software, 4Cast XL will be focusing only on one of the main model that have successfully found application across a broad range of business areas. We call this model a multilayered feedforward neural network (MFNN) and is an example of a neural network trained with supervised learning.

With supervised learning models, the training data contains complete information about the characteristics of the data and the observable outcomes. Models can be developed that learn the relationship between these characteristics (inputs) and outcomes (outputs). Using a MFNN to model the relationship between money spent during last week’s advertising campaign and this week’s sales figures is an example of a prediction application. An example of a related classification application is using a MFNN to model the relationship between a customer’s demographic characteristics and their status as a high-value or low-value customer. For both of these example applications, the training data must contain numeric information on both the inputs and the outputs in order for the MFNN to generate a model. The MFNN is repeatedly trained with this data until it learns to represent these relationships correctly.

For a given input pattern or data, the network produces an output (or set of outputs), and this response is compared to the known desired response of each neuron. For classification problems, the desired response of each neuron will be either zero or one, while for prediction problems it tends to be continuous valued. The weights of the network are then updated to correct or reduce the error, and the next pattern is presented. The weights are continually updated in this manner until the total error across all training patterns is reduced below some pre-defined tolerance level. We call this learning algorithm as the backpropagation.

So we have,

Forward pass:
the outputs are calculated and the error at the output units calculated.

 
then,

 
Backward pass:
The output unit error is used to alter weights on the output units. Then the error at the hidden nodes is calculated (by back-propagating the error at the output units through the weights), and the weights on the hidden nodes altered using these values.
 

The main steps of the back propagation learning algorithm are summarized below:

Step 1: Input training vector.
Step 2: Hidden nodes calculate their outputs.
Step 3: Output nodes calculate their outputs on the basis of Step 2.
Step 4: Calculate the differences between the results of Step 3 and targets.
Step 5: Apply the first part of the training rule using the results of Step 4.
Step 6: For each hidden node, n, calculate d(n).
Step 7: Apply the second part of the training rule using the results of Step 6.

Steps 1 through 3 are often called the forward pass, and steps 4 through 7 are often called the backward pass. Hence, the name: back-propagation.

For each data pair to be learned a forward pass and backwards pass is performed. This is repeated over and over again until the error is at a low enough level (or we give up).

Graphically this is how a neural network look like...

 


 

The advantages of using Artificial Neural Networks software are:

1. They are extremely powerful computational devices

2. Massive parallelism makes them very efficient.

3. They can learn and generalize from training data – so there is no need for enormous feats of programming.

4. They are particularly fault tolerant – this is equivalent to the “graceful degradation” found in biological systems.

5. They are very noise tolerant – so they can cope with situations where normal symbolic systems would have difficulty.

6. In principle, they can do anything a symbolic/logic system can do, and more. (In practice, getting them to do it can be rather difficult…)

 

Real life applications

The tasks to which artificial neural networks are applied tend to fall within the following broad categories:

Manufacturing and industry:

Quality control

Six Sigma

Beer and wine flavor prediction

Highway maintenance programs

Telecommunication line fault detection

Government:

Missile targeting

Criminal behavior prediction

Banking and finance:

Loan underwriting

Credit scoring

Credit card fraud detection

Energy price prediction

Real-estate appraisal

Science and medicine:

Specimen identification

Protein sequencing

Tumor and tissue diagnosis

Heart attack diagnosis

New drug effectiveness

Prediction of air and sea currents

Air and water quality

We will examine some detailed case studies in our examples demonstrating how the MFNN (4Cast XL) has been successfully applied to problems as diverse as sales forecasting and time series prediction (weekly return of the DJIA)

 

2. Preparing Data  (back)

The input data to neural network is not always hard physical measurements. Scaling the data sometimes is needed so that the neural network can learn better. 4Cast XL use a sigmoidal activation function as its output. Therefore, user need to scale the input data first so that the target activations to values can be comfortably learned. Please take note that 4Cast XL only process numeric data.

Scaling of variables and data is  automated. Just select  Scale Data on the 4Cast XL menu and the input form below will be shown:

                       

Enter the reference that you want to scale in the Input Range. Then specify the maximum and minimum scale range. Click on the Scale Now button. The raw data will be scaled. Neural net will learn better if  there is uniformity in the data.

3. Getting Started  (back)

i)                    Select Create Network in the 4Cast XL menu. You can enter 3 or 4 Layers  Of  Network.

 

ii)                   Enter the reference (e.g. a3:e24) in the Input Range. Enter the targeted output range in the Target Range. 4Cast XL will automatically show the number of input and output nodes in the Nodes Frame. (back)

iii)                 Enter the the number of hidden nodes desire with the spinbutton.

iv)                 Click on the Next button. The Worksheets ( Network Ouput ) will be created. This worksheet will contain all the report that the user need to do a detail analysis. (i.e. hidden layer output, connection weights, pattern error and epoch MSE ).

v)                  The Training Methods Dialog form will be shown. Select the training option that you want. Training option includes Backpropagation with momentum, Conjugate Gradient and Genetic Optimization. Select the checkbox  Show MSE Graph to show the training error in each epoch.

vi)                 Again, click on the Next button. (back)

vii)               The BP Dialog form will be shown if Backpropagation with momentum is choosen. Click on the Intialize New Weights (optional). A new set of weights will be created. 4Cast XL will set the weights automatically or by user choice. Enter the learning and momentum rate . State how many epoch the network will be training (maximum 15,000) or you can also determine how long the network will train by selecting the Stop After option. Maximum time allowable is 300 minutes. User can use default setting also. Click on the Train button to start training. Please double check that it is the right network architecture. This is shown in the Network Architecture frame. User can stop training prematurely by clicking the End button.( Note: MSE graph will not be updated if user do this. This  might take a  few seconds.)

 

viii)              The CG Dialog form will be shown if Conjugate Gradient is choosen. Click on the Intialize New Weights (optional). A new set of weights will be created. 4Cast XL will set the weights automatically or by user choice. State how many epoch the network will be training or you can also determine how long the network will train by selecting the Stop After option. Maximum time allowable is 300 minutes. User can use default setting also. Click on the Train button to start training. Please double check that it is the right network architecture. This is shown in the Network Architecture frame. User can stop training prematurely by clicking the End button.( Note: MSE graph will not be updated if user do this. This  might take a  few seconds.) (back)

 

ix)                 The GO Dialog form will be shown if Genetic Optimization is choosen. Click on the Intialize New Population. A new set population which represent weights will be created. State how many generation the network will be training or you can also determine how long the network will train by selecting the Stop After option. Maximum time allowable is 300 minutes. It is recommended that user use default setting. Click on the Train button to start training. Please double check that it is the right network architecture. This is shown in the Network Architecture frame. User can stop training prematurely by clicking the End button.( Note: MSE graph will not be updated if user do this. This  might take a  few seconds.)

 

4.    Testing And Predicting (back)

Select the Test And Predict in the 4Cast XL menu. A dialog form as below will be shown. Again, please double check that it is the right network architecture. This is shown in the Network Architecture frame. Enter the range to be tested in the Input Range and also the Target Range. Click the Test button.

                      

                     

To predict, enter the reference range in the Input Range. You can leave the Target Range blank. Click on the Predict button. The Predict form will be shown. Enter the output range and click OK. The predicted output will appear in the output range stated. GOOD LUCK !!!

 

  1. Advanced Issues.  (back)

NN work best with numeric data. Sometimes, the data that represent a problem are non numeric. Therefore, dates , time and colour as well as textual data need to be processed beforehand. Additional processing is required and transformation of such data is done before feeding them to the network input and after their reception at the output. Outliers and missing data should be kept at minimum.

The number of inputs, number of hidden units, amount of data, difficulty of the task and capability of your computer will affect the training speed of the network. Therefore, try to enter the minimal number of hidden nodes. A good example will be the pyramidal scheme for constructing network architecture.

It is advisable for user to use different workbook to create different network architectures. Or user can rename the Network Output worksheet if new network architecture is being created in the same workbook. 4Cast XL will load the network model ascertain in the Network Output worksheet.

A complete analysis is presented in the Network Output worksheet. User can view and analyse the network model.(e.g. Each pattern output and error is presented thus, user can determine whether the network has learn well for a particular pattern.) In the hidden layer output, user will know which node is redundant or active. Weights of the network are also reported.

Varieties and adequate representation of data is vital in designing the training set. Larger model require larger training set. E.g. a 20 input neurons with 20 hidden neurons will require at least 1000 training samples or more. As a rule of thumb, count the number of weights parameter in the network and double it to get the minimum number of training sample required. The test set usually comprise  25% of all the training samples.

 

   6.    System Requirement. (back)

 The following are the minimum installation requirements:

 

  7.     Example 1:  Time-series forecasting (back)

 

Step 1: Preparing Data

 

The input data to neural network is not always hard physical measurements. Scaling the data sometimes is needed so that the neural network can learn better. 4Cast XL use a sigmoidal activation function as its output. Therefore, user need to scale the input data first so that the target activations to values can be comfortably learned. Please take note that 4Cast XL only process numeric data.

All the data need to be converted to the between 0 to 1. Neural network will learn better if there is uniformity in the data. Here, a real life example is use. This data is taken from the DJIA weekly prices, from the period from 22 April 2002 to 22 Oct 2007. Let’s organize the data first. The basic assumption for time series forecasting is that the pattern found from historical data will also hold in the future. In practice, we partition the data into two parts.

The first part is used to train the neural network, while the second part of data is used to test the performance of the model. A model is considered good if the error of out-of-sample testing is the lowest compared with the other models. If the trained model is the best one for validation and also the best one for testing, one can assume that it is a good model for future forecasting.

There are tradeoffs for testing and training. One should not say it is the best model unless he has tested it, but once he has tested it, he has not trained enough. The general partition rule for training and testing set is 70% and 30%, respectively.

a) Scaling of variables and data is  automated. Just select  Scale Data on the 4Cast XL     menu (see Figure 1.1) and the input form below (Figure 1.2) will be shown:

 

  (Figure 1.1)

 

(Figure 1.2)

 

For column J, the input data consist of the 5 days moving averages of the DJIA weekly prices, column K consist of 10 days moving averages and so on. The highest price during the period from 22 April 2002 to 22 Oct 2007 is 14,093.08 and the lowest price is 7528.4.

288 weekly data is entered accordingly from column J2 to N289. Column O is the output/target data consist of actual weekly closing. (see Figure 1.13A)

(Figure 1.13A)

 

Thus we need to convert the data in the range J2:O289 (6 columns times 288 rows). Enter J2:O289 into the Input Range edit box. Press the Tab key on your keyboard to exit. When you press Tab, 4Cast XL will automatically load the maximum (14,093.08) and the minimum (7528.4) in the Raw Data frame Min and Max textbox.

By default in the Convert Data Into frame, 4Cast XL use the value 1 for maximum and 0.1 for minimum (see Fig 1.2) above. Of course you can change this. It is advisable not to use the value 0 as the minimum as it represent nothing.

Click on the Scale Now button and all the data in the range J2:O289 will be converted to 0.01 to 1. (see Figure 1.3 below)

 

(Figure 1.3)

 

4Cast XL will also automatically store the minimum (in cell J292) and the maximum (cell J291) value of the raw data in the last row and first column of the raw data. (see Figure 1.4 below)

 

(Figure 1.4)

 

b) After converting the raw data, click on the X at the top right of dialog form to exit. Now we need to partition the data into 2 parts.

i)                    Part 1, row 2 to row 200 as the training data

ii)                   Part 2, row 201 to row 288 as the testing data.

User can start to build the neural network model after this.

 

Step 2: Building the architecture of the neural network model.

 

a) Select Create Network on the 4Cast XL menu (see Figure 1.5) and the dialog box  4Cast XL (1 of 3)  will be displayed (see Figure 1.6).

 (Figure 1.5)

 

(Figure 1.6)

 

-         Select 3 on the Layers of Network. Proven to be very effective on time-series forecasting.

-         On the Input Range edit box, enter the range J2:N200 (five columns of inputs and 199 rows of input pattern, i.e. the training data). Each time you exit, please use the Tab key on your keyboard.

-         On the Target Range edit box, enter the range O2:O200 (1 column of output/target and 199 rows of pattern to be learned). Tab!!! When you tab to exit, 4Cast XL will automatically load the number of input column in the Inputs textbox on the Nodes frame. (Here we’ve 5 inputs)

-         On the Hidden 1 textbox of the Nodes frame, enter 3. This mean that we have select 3 nodes for the hidden layer. The general rule to follow here is that we use the pyramidal scheme, 5-3-1. (you can also try 5-4-1, 5-2-1 etc)

-         The Output textbox on the Nodes frame is already loaded with the value 1 as this is done automatically by 4Cast XL as well.

-         Click the Next button.

 

       Graphically, it looks like this: (see below)

 

                                                                                 

 

Click on the Next button and the dialog box 4Cast XL (2 of 3) below will be shown(see Fig 1.7). The worksheet Network Output will be created. This worksheet is very important as it is use to store the the model architecture(display on the Network Architecture frame), the weights(w1 to w18 ) and all other important parameters. (see Figure 1.7)

 

(Figure 1.7)

 

 Currently, the worksheet is blank as we have not start training yet.

b) Select the training option that you want in the Training Methods frame. Training option includes Backpropagation with momentum, Conjugate Gradient and Genetic Optimization. Select the checkbox  Show MSE Graph to show the training error in each epoch. (the Genetic Optimization training option will be discussed in Example 2)

Choose the Conjugate Gradient training method. Click the Next button again and the Conjugate Gradient training method dialog form (see Fig 1.8 below) will be display.

 

Step 3: Training the network model

 

(Figure 1.8)

 

Select the Initialize new weights. 18 rows of value for the weights will be generated in G2:G19. (Note: This is optional as 4Cast XL will generate the weights for you automatically if you didn’t click on this button)

You also have the option to run the program for how many loops / Epoch (maximum for this program is 15000) or you can select the option to run the program for how many minutes. (maximum 300 minutes). User can stop training prematurely by clicking the End button.( Note: MSE graph will not be updated if user do this. This might take a few seconds.)

Click the Train button to start training the model. The Synapses Screen will be shown.(see Fig 1.9 below) and the program will start running.

 

(Figure 1.9)

    (

You can see the activities of the neural network model training. For experience user, they will know whether a suitable model has been built, whether enough hidden layers is created, whether the network has good starting weights etc, just by looking at this screen. 4Cast XL is the only neural network program in the world that has this feature.

 

 (Figure 1.10)

 

The number of Epoch and the Mean Square Error (MSE) will be shown in the Status Bar (see Figure 1.10 above)

A message box will pops up after the model has finish training for the current session. (see Fig 1.11)

 

 (Figure 1.11)

 

User can stop training prematurely by clicking the End button.( Note: MSE graph will not be updated if user do this. This might take a few seconds.)

Here it show 0.003883 which is not satisfactory. Usually we need the MSE value to be below 0.001 or after training for 30000 epochs. As the result is not satisfactory we need to train the network model again.  Before that, take a look at the Network Output worksheet. You’ll see all the parameters generated on this sheet. Don’t change anything here.

A complete analysis is presented in the Network Output worksheet. User can view and analyse the network model.(e.g. Each pattern output and error is presented thus, user can determine whether the network has learn well for a particular pattern.) In the hidden layer output, user will know which node is redundant or active. Weights of the network are also reported. User can also use the data here for graphing purposes, for example the Actual Vs Forecasted chart, Sensitivity of Inputs chart, error distribution chart, correlation graph etc.

For example, if you want to built the Actual VS Forecasted chart, go to the Network Output worksheet and copy the output (Output 1 in column I ) and paste it beside the Target column in the data sheet. (see Figure 1.11B below)

 

                               (Figure 1.11B)         

As the result is not satisfactory, we need to continue training the network model.

 

Step 4: Retraining the Network Model.

 

Here we do not need to rebuilt the whole network again. Make sure you have select the sheet that contain the training data as the active sheet before execute the step below.

-         Select Load Network on the 4Cast XL menu (see Fig 1.12 below) and the dialog box  4Cast XL (2 of 3) will be displayed (see Figure 1.7 above)

 

 (Figure 1.12)

 

-     Choose the Conjugate Gradient training method and go through the whole process  again until you’ve train the model for 20000 to 30000 epoch or when the MSE reach below 0.001.

Do not click on the Initialize New Weights unless you want to change a new set of weights. Here 4Cast XL will use the weights contain in the weight i.e.G2:G19 generated from the previous training session.

(For advance user, you can change the weights vector by selecting the Initialize New Weights to initialize new weights if you feel that the current model does not have good starting weights)

If you have no confidence on the network model and need to change or create a new model altogether with different architecture then goto Step 5 else goto Step 6.

 

Step 5 : Re-Create the Neural Network Model

 

i)                    It is advisable for user to use different workbook to create different network architectures.

ii)                   Or user can rename the Network Output worksheet if new network architecture is being created in the same workbook. 4Cast XL will prompt user to rename the Network Output worksheet.

iii)                 Go through Step 2 , 3, 4 again until you are satisfied with the result.

iv)                 If you are satisfied with the result then go to Step 6.

 

Step 6: Testing

After you are satisfied with the training result, its time to test the neural network model. For our current example, the network model was trained for 10,000 epochs and the MSE has reach 0.00113.

i)                    Select Test or Predict on the 4Cast XL menu (see Fig 1.13) and the dialog box Test and Predict will be display. (see Figure 1.14)

 

 (Figure 1.13)

 

 (Figure 1.14)

 

ii)                   Enter J201:N288 in the Input Range edit box

iii)                 Enter O201:O288 in the Target Range edit box

             Remember that we have allocated row 201 to 288 as the test set.

iv)                 Select the Test button. 4Cast XL will run the test and pops up a message box  displaying the Test Error and will also be stored on the Network Output worksheet (see Fig 1.15)

 

 (Figure 1.15)

 

Here the test error is 0.00676 (see Figure 1.15) which is also display on the Network Output sheet. The MSE is 0.00113. The general rule here is that the test error and the actual MSE should not have a big difference. For example MSE = 0.00067 and Test error is 0.00089, this can be consider good modeling and suitable to be used as a forecasting model in real life scenario.

If you have no confidence on the result or after training for 20,000 to 30,000 epochs and the network model show no improvement, then you need to re-built the neural network and go through Steps 2,3,4 and 6. Neural network forecasting requires lots of training and testing before you can apply it to real life situations.

You will need some time to learn and to experience before you can gain the confidence to use neural network as a forecasting tool. Once you’ve became an expert user, you will be amaze when neural network shows its magic!!!

The result of the current model is quite satisfactory, after training and testing, its time now to do the prediction.

 

Step 7: Predicting

 

i) Select Test or Predict on the 4Cast XL menu (see Fig 1.13 above) and the dialog box Test and Predict will be display. (see Figure 1.16 below). Enter J289:N289, i.e. the 5 input factors to predict the outcome/result ( i.e. 1  row of MA5, MA10, MA20, MA60 and MA120 ). Leave the Target Range blank.

 

 (Figure 1.16)

 

ii)                   Click on the Predict button to bring up the Predict dialog box (Figure 1.17), enter O289 so that the result/output of the prediction will be contained on this cell.

 

 (Figure 1.17)

 

iii)                 Click the OK button and the result will be displayed on the cell O289 in blue color font. The Confidence Level of 86.29% is also shown next to it. (Fig 1.18)

 

(Figure 1.18)

 

iv)                 Next we need to convert this result/output back to the Dow Jones weekly price. (as 0.93 doesn’t mean anything to us)

Select Scale Data on the 4Cast XL menu (see Figure 1.1 above) and the dialog form below (Figure 1.19) will be shown: (we also do this step when we first convert the raw data)

 

(Figure 1.19)

 

Remember that 4Cast XL has stored the minimum in cell J292 and maximum in cell J291 of the raw data when we first convert the data in Step 1. Now we reverse the process. (see Figure 1.19)

v)                  Click the Scale Now button and we have the predicted result as 13582.49, (0.93 become 13582.49…see Figure 1.20 below)

 

(Figure 1.20)

 

To conclude, 4Cast XL predict that next week DJIA closing price is 13582.49.

 

Back to top