How to continue training my neural network

조회 수: 10 (최근 30일)
Artur Movsessian
Artur Movsessian 2018년 5월 10일
댓글: Qiang Li 2019년 1월 15일
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?

채택된 답변

Omanshu Thapliyal
Omanshu Thapliyal 2018년 5월 25일
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

추가 답변 (2개)

Greg Heath
Greg Heath 2018년 5월 27일
편집: Greg Heath 2018년 5월 27일
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

Artur Movsessian
Artur Movsessian 2018년 6월 9일
Yes all the data will be exactly the same but it is split into 4.000 files that is why I wanted to know to continue the learning process once I am done with one file. Thanks for your answers
  댓글 수: 1
Qiang Li
Qiang Li 2019년 1월 15일
Hi Artur,
Have you figured out how to do this? I'm facing basically the same problem. Are you eventually using adapt()+fitnet()?
Thanks

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by