| Products & Services | Industries | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Neural Network Toolbox |
| Contents | Index |
Sample Training Session
A number of different concepts are covered in this chapter. At this point it might be useful to put some of these ideas together with an example of how a typical training session might go.
This example uses data from a medical application [PuLu92]. The goal is to design an instrument that can determine serum cholesterol levels from measurements of spectral content of a blood sample. There are a total of 264 patients for which there are measurements of 21 wavelengths of the spectrum. For the same patients there are also measurements of HDL, LDL, and VLDL cholesterol levels, based on serum separation. The first step is to load the data into the MATLAB® workspace.
Next, create the network. The network object should process inputs by normalizing their standard deviation and performing principal component-analysis using a maximum fraction of 0.001. The targets are normalized for standard deviation.
net = newff(p,t,5); net.inputs{1}.processFcns = {'mapstd','processpca'}; net.inputs{1}.processParams{2}.maxfrac = 0.001; net.outputs{2}.processFcns = {'mapstd'};
You are now ready to create a network and train it. For this example, try a two-layer network with the default tan-sigmoid transfer function in the hidden layer and linear transfer function in the output layer. This is a useful structure for function approximation (or regression) problems.
As an initial guess, use five neurons in the hidden layer. The resulting network will have three output neurons because the target vectors have three elements. The default Levenberg-Marquardt algorithm is used for training.
The training stopped after 21 iterations because the validation error increased. It is a useful diagnostic tool to plot the training, validation, and test errors to check the progress of training. You can do that with the following commands:
The following figure shows the result. The result here is reasonable, because the test set error and the validation set error have similar characteristics, and it doesn't appear that any significant overfitting has occurred.
The next step is to perform some analysis of the network response. Put the entire data set through the network (training, validation, and test) and perform a linear regression between the network outputs and the corresponding targets. First, calculate the network outputs:
In this case, there are three outputs, so there are three regressions. The next figure shows the results.
The first two outputs seem to track the targets reasonably well (this is a difficult problem), and the R-values are around 0.9. Modeling the third output (VLDL levels) is not as successful and the problem needs more work. You might go on to try other network architectures (more hidden layer neurons), or to try Bayesian regularization instead of early stopping for the training technique. Of course there is also the possibility that VLDL levels cannot be accurately computed based on the given spectral components.
The demonstration demobp1 contains the sample training session. The function nnsample contains all the commands used in this section. You can use it as a template for your own training sessions.
| Provide feedback about this page |
![]() | Preprocessing and Postprocessing | Limitations and Cautions | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |