How to continue training my neural network

37 visualizzazioni (ultimi 30 giorni)
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?

Risposta accettata

Omanshu Thapliyal
Omanshu Thapliyal il 25 Mag 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

Più risposte (2)

Greg Heath
Greg Heath il 27 Mag 2018
Modificato: Greg Heath il 27 Mag 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

Artur Movsessian
Artur Movsessian il 9 Giu 2018
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 Commento
Qiang Li
Qiang Li il 15 Gen 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

Accedi per commentare.

Categorie

Scopri di più su Sequence and Numeric Feature Data Workflows in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by