Feedforward Nueral Networks Training

3 views (last 30 days)
Felicia Ojinji
Felicia Ojinji on 2 Dec 2020
Answered: Swetha Polemoni on 7 Dec 2020
I have trained a feedward neural network. I used the tr function to get the netwrok parameters shown below. I would like to know the time elapsed in training the network as this would help me make a better comparison while using other training functions. However, I do not understand what " time: [1×82 double]" means.
Please can someone tell me how i can find out the time taken to train the network in seconds?
>> tr
tr =
struct with fields:
trainFcn: 'trainlm'
trainParam: [1×1 struct]
performFcn: 'mse'
performParam: [1×1 struct]
derivFcn: 'defaultderiv'
divideFcn: 'dividerand'
divideMode: 'sample'
divideParam: [1×1 struct]
trainInd: [1×6132 double]
valInd: [1×1314 double]
testInd: [1×1314 double]
stop: 'Validation stop.'
num_epochs: 81
trainMask: {[1×8760 double]}
valMask: {[1×8760 double]}
testMask: {[1×8760 double]}
best_epoch: 71
goal: 0
states: {'epoch' 'time' 'perf' 'vperf' 'tperf' 'mu' 'gradient' 'val_fail'}
epoch: [1×82 double]
time: [1×82 double]
perf: [1×82 double]
vperf: [1×82 double]
tperf: [1×82 double]
mu: [1×82 double]
gradient: [1×82 double]
val_fail: [1×82 double]
best_perf: 2.0020e+06
best_vperf: 1.8338e+06
best_tperf: 2.1547e+06
Thank you

Answers (1)

Swetha Polemoni
Swetha Polemoni on 7 Dec 2020
Hi Felicia Ojinji,
  • It is my understanding that you want to calculate how much time has been taken by your network to train. You may find "tic" and "toc" functions useful. Below code
A = rand(12000,4400);
B = rand(12000,4400);
The above code gives the elapsed time, in seconds ,between tic and toc. In other words time taken to generate matrices A and B. You may place your code between tic and toc to get the time taken by those lines of code to run.
  • You can also use "trainingOptions" for plotting training progress, where information about elapsed time is also given. To plot training progress during training, specify 'training-progress' as the 'Plots' value in trainingOptions. Here is an example that shows how to plot training progress.

Community Treasure Hunt

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

Start Hunting!

Translated by