Data Division in MATLAB Neural Network Train Command
Mostrar comentarios más antiguos
While training a neural network in MATLAB I am using "train" command. Is this command auto divide the data into training, testing, and validation sets or we have to divide the data manually.
Respuestas (1)
Greg Heath
el 13 de Sept. de 2016
Editada: Greg Heath
el 13 de Sept. de 2016
Consider the example in the fitnet help documentation:
help fitnet
[x,t] = simplefit_dataset; net = fitnet(10);
net = train(net,x,t); view(net)
y = net(x); perf = perform(net,t,y)
or, better yet, the "greg" version. Notice the absent
semicolons for automatic printing to sceen
close all, clear all, clc
[x,t] = simplefit_dataset;
[ I N ] = size(x) % [ 1 94 ]
[ O N ] = size(t) % [ 1 94 ]
plot(x,t); hold on
vart1 = var(t,1) % Reference MSE = 8.3378
net = fitnet; % H = 10 default
% However, the 4 local extrema in the plot suggest
% that H = 4 is optimal
rng(0) % For replication
[net tr y e ] = train(net,x,t);
% y = net(x); e = t-y;
view(net)
plot( x ,y ,'r--' ) % Recent modification
NMSE = mse(e)/ vart1 %1.7558e-05
Rsq = 1-NMSE % 1.000
Now, to answer your question, type in the
command window
>> net.divideFcn
ans =
dividerand
>> net = net % No semicolon
ans = SURPRISE !!!
Categorías
Más información sobre Pattern Recognition en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!