MATLAB: How to use Neural Networks to create several networks instead of creating one by one manually

estimationneural networksnntoolseveral variables

Hey,
I would like to create several neural networks models and estimations using for each one of them 2 variables as inputs and 1 variable as output. For a single stock I would use the NNtool to first construct the model and then do the estimation. What I would like to know is how could I do this for all the stocks (30 stocks and for each one of them I would like to create a nn estimation) in an automatic way without having to run the wizard for each one of them.
Thanks you for your support,
Best regards,
Sarah

Best Answer

You can do it with nested for loops. Indexed nets should be stored in cells. However, it is not clear what the difference in inputs is for the 30 stocks. Also, what are the outputs? I assume this is regression and not classification. Therefore you should use the FITNET version of feedforwardnet (NEWFIT version of newff if you are using the obsolete version).
A single hidden layer is sufficient. Accept all defaults except the number of hidden nodes, H=10; Try to use the smallest value of H that yields acceptable results.
Also, you have to take into account that some designs will be bad because of an unfortunate assignment of random initial weights. Therefore, for each case, multiple random initial weight designs will have to be made to obtain an acceptable one.
I typically look at Ntrials = 10 random initialization designs for each of ~10 candidate values for H. Search using
greg fitnet Ntrials
Hope this helps.
Thank you for formally accepting my answer
Greg