Neural Network Script to have Specific Testing Data from Inputs.

3 ビュー (過去 30 日間)
Richard
Richard 2014 年 10 月 12 日
コメント済み: Richard 2014 年 10 月 19 日
Hello everyone,
I have been trying to write a neural network script that uses DivideInd to train my neural network. I'm using all the data for my input as the training and validating data for the neural network, however for the testing data I am using only the initial third of the data. However when I run the script, I run into the issue of,
??? Undefined function or method 'patternnet' for input arguments of type 'double'.
My code is as shown below, and yes I have made sure to be in the working directory when I run the script so that is not the issue.
inputs = Hand_Data_Inputs;
targets = Hand_Data_Targets;
% Create a Pattern Recognition Network
hiddenLayerSize = 31;
net = patternnet(hiddenLayerSize);
% Set up Division of Data for Training, Validation, Testing
net.divideFcn = 'divideInd';
net.divideParam.trainInd = 1:3000;
net.divideParam.valInd = 1:3000;
net.divideParam.testInd = 1:1000;
% Train the Network
[net,tr] = train(net,inputs,targets);
% Test the Network
outputs = net(inputs);
errors = gsubtract(targets,outputs);
performance = perform(net,targets,outputs);
Any help would be greatly appreciated, thank you
  4 件のコメント
Richard
Richard 2014 年 10 月 12 日
Hmmmmmm, I typed
which patternnet -all
and it came up as,
'patternet' not found.
Star Strider
Star Strider 2014 年 10 月 12 日
If you have the Neural Network Toolbox installed (I assume you do), see if my Answer solves the problem.

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

採用された回答

Greg Heath
Greg Heath 2014 年 10 月 13 日
Your data division makes no sense.
Although the trn, val, and tst subsets can overlap in space, they should not contain common points.
total = design + test
design = train + val
train: estimate weights
val: stops training when performance on NONTRAINING val subset reaches a local optimum. However, resulting nontraining performance estimate is biased because validation is part of the design
test: yields UNBIASED estimate of performance on unseen nontraining data
Hope this helps
  • Thank you for formally accepting my answer *
Greg
  7 件のコメント
Richard
Richard 2014 年 10 月 19 日
Just had a check of tr and realised that the test index doesn't appear declared. Not too sure as to why this is happening
Richard
Richard 2014 年 10 月 19 日
Again thank you for all the help you have provided so far Professor Heath

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by