How to continue training my neural network
28 views (last 30 days)
Show older comments
Artur Movsessian
on 10 May 2018
Commented: Qiang Li
on 15 Jan 2019
If i use this basic neural network code to train my neural network how can I save my neural network and continue training it with neu data. I have 4.000 10min files with each 30.000 data. I generate from each file my matrix for independent variables and my vector for my dependent variable. I train the neural network and then I would like to continue training after I read in my next file and generate my new matrix for the neural network.
% Solve an Input-Output Fitting problem with a Neural Network
% Script generated by NFTOOL
%
% This script assumes these variables are defined:
%
% houseInputs - input data.
% houseTargets - target data.
inputs = A';
targets = res_FFF';
% Create a Fitting Network
hiddenLayerSize = 10;
net = fitnet(hiddenLayerSize);
% Set up Division of Data for Training, Validation, Testing
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
% Train the Network
[net,tr] = train(net,inputs,targets);
% Test the Network
outputs = net(inputs);
errors = gsubtract(outputs,targets);
performance = perform(net,targets,outputs)
% View the Network
view(net)
% Plots
% Uncomment these lines to enable various plots.
% figure, plotperform(tr)
% figure, plottrainstate(tr)
% figure, plotfit(targets,outputs)
% figure, plotregression(targets,outputs)
% figure, ploterrhist(errors)
% Train the Network [net,tr] = train(net,inputs,targets);
Is it possible to have new inputs every loop and apply the "train" function to continue the training process? Or will this function overwrite my already trained network?
0 Comments
Accepted Answer
Omanshu Thapliyal
on 25 May 2018
This looks like a use case for incremental learning using the adapt function. This documentation deals with the same problem of "adaptively" training the network when new data is presented: https://www.mathworks.com/help/nnet/ug/neural-network-training-concepts.html#bss326e-6
0 Comments
More Answers (2)
Greg Heath
on 27 May 2018
Edited: Greg Heath
on 27 May 2018
In order to successfully continue training with new data,
1. Either
a. The new data has similar summary statistics as the older data
b. New and old data are combined
2. Either
a. The physical configuration remains fixed
b. Hidden nodes are added to account for the new data (I have
obtained excellent results with radial basis functions)
Thank you for formally accepting my answer
Greg
0 Comments
Artur Movsessian
on 9 Jun 2018
1 Comment
Qiang Li
on 15 Jan 2019
Hi Artur,
Have you figured out how to do this? I'm facing basically the same problem. Are you eventually using adapt()+fitnet()?
Thanks
See Also
Categories
Find more on Sequence and Numeric Feature Data Workflows in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!