Want to use something like dividerand and then apply the indices over and over with various fitnet & train combinations?
2 views (last 30 days)
Show older comments
For example in the following code after running dividerand I can see the indices for the train, validation and test values.
However as soon as it sees trainbr, it eliminates the validation indices, which I don't want it to do so. When I create a new fitnet using trainlm it is no longer using the same train, validation and test values.
Any ideas?
x = -1:0.05:1;
t = sin(2*pi*x) + 0.1*randn(size(x));
[trainT,valT,testT] = dividerand(length(t),80/100,10/100,10/100); % maybe make eval percentage 0 if trainbr, but not necessary since:
% "Validation stops are disabled by default (max_fail = 0) so that
% training can continue until an optimial combination of errors and
% weights are found"?
net = fitnet([20,20],'trainbr'); % [20,10] means 2 hidden layers 1st w size 20 & 2nd w size 10
% help(net.trainFcn) to see the default settings
% disable fitnet from using mapminmax if using my scaling algo
[net,tr] = train(net,x,t); % trains the NN and tr contains all kinds of metadata
view(net) % sb after train
y = net(x);
perf = perform(net,y,t)
%doing fitnet then train again to see if still using same indices for
%trainT,valT, testT in the train function
net = fitnet([20,10],'trainlm'); % [20,10] means 2 hidden layers 1st w size 20 & 2nd w size 10
% help(net.trainFcn) to see the default settings
% disable fitnet from using mapminmax if using my scaling algo
[net,tr] = train(net,x,t); % trains the NN and tr contains all kinds of metadata
view(net) % sb after train
y = net(x);
perf = perform(net,y,t)
0 Comments
Answers (0)
See Also
Categories
Find more on Function Approximation and Nonlinear Regression 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!