Data Division in MATLAB Neural Network Train Command
이전 댓글 표시
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.
답변 (1개)
Greg Heath
2016년 9월 13일
편집: Greg Heath
2016년 9월 13일
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 !!!
카테고리
도움말 센터 및 File Exchange에서 Pattern Recognition에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!