How to disable validation and test data set in neural network

27 ビュー (過去 30 日間)
Emiliano Rosso
Emiliano Rosso 2017 年 3 月 22 日
回答済み: Greg Heath 2020 年 2 月 14 日
I need to train patternnet neural network using all data set in the training set and avoiding validation check. I found two methods and they works very well in command line but not in a script returning very simple errors.
method 1:
mynet.divideFcn = '';
method 2:
mynet.divideParam.trainRatio = 1;
mynet.divideParam.valRatio = 0;
mynet.divideParam.testRatio = 0;
and the code:
mynet=patternnet([]);
P=rand(10,1000);
T=rand(2,1000);
[mynet,tr]=train(mynet,P,T);
Matlab R2012 b windows xp 32
Thanks !

回答 (2 件)

Greg Heath
Greg Heath 2020 年 2 月 14 日
You have to define net before modifying any properties.
clear all, close all, clc
[x,t] = iris_dataset;
for i = 1:2
net = patternnet([]);
if i==1
net.divideFcn = '';
else
net.divideParam.trainRatio = 1;
net.divideParam.valRatio = 0;
net.divideParam.testRatio = 0;
end
net = train(net,x,t);
view(net)
y = net(x);
MSE(i) = mse(y-t)
end
MSE = 0.0084 0.0084
Hope this helps.
Greg

Prasanth Sundaravelu
Prasanth Sundaravelu 2018 年 4 月 26 日
編集済み: Prasanth Sundaravelu 2018 年 4 月 26 日
Hi, I think you need to type specific Divide function, instead of blank.
Try this : mynet.divideFcn = 'dividerand';
  1 件のコメント
NILESH TANPANIYA
NILESH TANPANIYA 2020 年 2 月 14 日
Hi,
dividerand is the inbuilt function i think

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by