The program trains several neural networks (that vary in their number of hidden layer neurons) and enables users to pick the best.
The program trains the networks using input and target data contained in files named Inputs1.txt and Targets1.txt respectively.
The program randomly splits the supplied data into 3 portions: 70% for training, 15% for validation, and 15% for testing. The user has the option to change this proportioning in lines 68 to 70.
The user also has the option to use his/her own test data: these should be saved in same format as Inputs2.txt and Targets2.txt
When the program runs, it trains 100 different networks: the networks differ in their number of hidden layer neurons. The networks generated are saved in in a folder named networks, within the same folder where this program is run. The network saved as net1 has 1 hidden layer neuron, net2 has 2, net3 has 3, net4 has 4,....
Users may change the values 1:100 in line 65 to their desired values.
Training is done using the Levenberg-Marquardt algorithm, trainlm. Users may change to their desired algorithm by changing line 62.
The program also computes and saves root-mean-squared-errors (RMSEs) in a file named rmse.txt. Data in the file is in 3 columns: column 1 for the number of hidden layer neurons, column 2 for the RMSE computed on the random 15% test data, and column 3 for the RMSE computed on the user's own test data.
The data on this file guides the user to decide which of the networks is best. Networks with smaller RMSEs are better, especially for the RMSEs computed on the user's own test data which is outside the range of data used for the training. More detailed guide on how to use the RMSEs to choose an optimal network is contained in a book authored by the writer of this program and titled "Computer Neural Networks on MATLAB"
Daniel Okoh (2022). Neural Network Training Code (https://www.mathworks.com/matlabcentral/fileexchange/59362-neural-network-training-code), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!