Saving multiple runs within a neural network

3 views (last 30 days)
Tyler Menz
Tyler Menz on 22 Jan 2020
Edited: Vimal Rathod on 30 Jan 2020
Hello, I'm using a neural network to analyze a time series dataset with roughly 15,000 lines of data. I'm running abundance data against environmental variables looking for correlations. I'm running the network 100 times for each different parameter to get accurate results. The issue i'm having is that the network is only outputting the results from the last run and I'd like to save them all.
I've incorporated the following into the end of my network to try and save the outputs, targets, p-values, and r2 for each run
for k=1:100
p=1;
q= 15843;
outputmat(p:q,1) = targets;
outputmat(p:q,2) = outputs;
but it is still just saving the last batch of results. Any clue how to get it to save all the data i'm looking for?

Answers (1)

Vimal Rathod
Vimal Rathod on 30 Jan 2020
Edited: Vimal Rathod on 30 Jan 2020
It seems the outputmat does not depend on the k value of your "for loop" and thus it is updating the same values in the loop.
You could use
for k = 1:100
p = 1;
q = 15000;
outputmat(p:q , 2*k-1) = targets;
outputmat(p:q , 2*k) = outputs;
end
Hope this helps!

Community Treasure Hunt

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

Start Hunting!