Tutorial: Improving Your Predictions: Optimize the Selection of Multiple Inputs
Optimize the Selection of Multiple Inputs
i Tutorial Task
Use genetic optimization to select between inputs.
This optional activity will show you how you can use genetic training optimization to optimize the selection of inputs to a prediction.
Commentary
Over the last few tutorial activities, we created several inputs that we used individually to improve our model of the optimal signal. The next step would seem to be to combine this information as multiple inputs to one model. If some information is good, then more information must be better.
This is frequently not the case with neural networks. Each time an input is added to a neural network model, additional weights must be added to process the information from that input. In essence, the available data must now be used to train the neural network to detect patterns in a more complex environment.
In a previous optional activity, we learned about the data-to-weights ratio. By default, TradingSolutions maintains a good ratio between the number of weights in the neural network and the amount of data available to train those weights. It does this by removing processing elements from the model as more inputs are added. This removal attempts to keep the network trainable, but typically makes the neural network less able to model the subtleties of the data.
One way to counteract this is to add more training data. Unfortunately, this has a different set of problems. Since financial conditions change over time, less recent stock market data tends to be less relevant in the training of neural networks. By default, TradingSolutions uses five years of data for training and testing. However, there are cases in which the earlier data could be considered irrelevant to the current markets. Adding more data increases the likelihood that this will occur.
A better solution is to concentrate on using only a set of inputs that provides the most useful information to the neural network. We have seen which inputs have created the highest percent gains when used individually. Using manual trial and error, we could also try all of the possible combinations of these inputs to determine which sets of these inputs provide the best results. Even with four possible inputs, this can create a lot of combinations.
Fortunately, we can let TradingSolutions determine the optimal set of inputs using genetic training optimization. At the same time, we can optimize the number of processing elements for the best results for the given number of inputs. Other settings, such as the memory depth and learning rates, can also be optimized at the same time.
Step-by-step Instructions
1. From the Modify Data Series Dialog: Data Fields page for “MBNA Cp”, make another copy of the original “Model: Optimal Signal (Default Trading Style)” field.
2. Select the new copy of this field and press the Modify… button.
3. On the Prediction Inputs page, add various fields as inputs to this model, such as the percent change in the High, Low, and Open prices, and the Vertical Horizontal Filter without preprocessing.
To try this, we will create another model of the optimal signal. However, this time, we will use as inputs every field we have used individually as an input to other models. From the Prediction Inputs page, add some or all of the following fields.
· The percent change of the High, Low, and Open fields.
· The raw value of “Vertical Horizontal Filter…”.
· The percent change in the closing price of the S&P 500 Index.
· The moving average of the S&P 500 Index (if you performed the optional activity that created that field).
4. On the Prediction Model page, select Use Optimization on Next Training.
5. Press the Training Optimization Options… button.
We want to use genetic training optimization during the training of this model, so select Use Optimization on Next Training on the Prediction Model page. However, unlike the steps in the main task, we do not want to use the default options for this optimization. Press the Training Optimization Options… button to change these options.
6. On the Optimization Options Dialog, deselect Use Global Defaults for These Values.
By default, TradingSolutions assumes that you want to use all of the inputs you have specified. Therefore, genetic optimization of the inputs is typically not enabled. To turn this option on, first deselect Use Global Defaults for These Values.
7. Select Input Selection from the Model Optimizations section of this dialog.
8. Switch to the Input Optimization page of this dialog to see which inputs will be optimized.
The Input Optimization page on the Optimization Options Dialog displays all of the inputs for this prediction. By default, all inputs are included in the optimization. This means that each input can be disabled, or removed, from the model while it is being optimized.
If you know that a specific input will be essential to modeling the desired output, you can deselect it from this dialog so that it is not disabled during genetic optimization. Essential inputs will most likely be kept during genetic optimization because they will yield better results. However, removing them from the optimization process will allow the optimization to concentrate on determining the remainder of the values that are needed.
In this case, we will leave all of the inputs selected. We could be reasonably sure that “%Change in Close” in an essential input. However, since we have not created any predictions without it, it may be worth including it in the optimization to verify it is needed.
9. Exit any open dialogs, pressing the OK button where available to save the changes you made.
The new model is now ready to be optimized. Exit from the Optimization Options Dialog by pressing OK, the Modify Field Dialog by pressing OK, and the Modify Data Series Dialog by pressing Close.
10. Repeat the steps we performed in the previous optional activity if you would like to stop the genetic optimization after a few generations.
To see how the genetic optimization task is doing, locate the optimization task in the Current Tasks Window and press the question mark [?] button next to it.
If you would like to stop the genetic optimization after a few generations, press the Stop Genetic button and confirm that you would like to stop the optimization.
11. Re-open the Modify Field Dialog for this field and examine the Prediction Inputs page. In many cases, one or more of the inputs will be deselected. The optimization was able to get better results without them at the point where the optimization stopped.
Genetic optimization of inputs works by turning on and off the values of inputs it supplies to the neural network. This is similar to open and closing valves to mix different chemicals. Inputs with checks next to them are supplied to the neural network while inputs without checkmarks are ignored.
12. Repeat the steps we performed in the previous optional activity if you would like to compare this optimized model to previous models.
The previous optional activity described several things you could look at after genetic optimization was performed, including the settings on the Modify Field Dialog: Prediction Model page and the comparing the normalized errors on the Modify Data Series: Predictions page.
13. Exit any open dialogs when you are finished.