Why isn't my network splitting between training and testing data?

I'm using divideFcn = 'divideind' and splitting by index. This usually works but it doesn't here and I don't know why. Here's my code
% import training data
filename = 'train.txt';
delimiter = ' ';
headerlines = 0;
A = importdata(filename, delimiter, headerlines);
% split training data into inputs and targets
inputTraining = A(1:2:end)';
targetTraining = A(2:2:end)';
% import testing data
filename = 'test.txt';
delimiter = ' ';
headerlines = 0;
A = importdata(filename, delimiter, headerlines);
% split testing data
inputTesting = A(1:2:end)';
targetTesting = A(2:2:end)';
% initialize the NRBF network with 1-hidden layer as usual. Change the
% function from RBF to NRBF. And set the training function to gradient
% descent
squaredErrGoal = .01;
spread = .1;
input = [inputTraining inputTesting];
target = [targetTraining targetTesting];
net = newrbe(input,target,spread);
net.layers{1}.transferFcn = 'radbasn';
net.trainFcn = 'traingd';
net = init(net);
view(net);
numTraining = length(inputTraining);
numTesting = length(inputTesting);
net.divideFcn = 'divideind';
net.divideParam.trainInd = 1:numTraining;
net.divideParam.valInd = numTraining+1:numTesting;
[net,tr] = train(net,input,target);
plotperf(tr);
figure(); %to create a new figure for the plotfit.
plotfit(net,input,target); % how many inputs and outputs can it handle?
xlabel('input');
legend({'target','output'})

 採用された回答

Greg Heath
Greg Heath 2018 年 1 月 6 日

0 投票

DO NOT USE THE FUNCTIONS NEWRBE, NEWGRNN OR NEWPNN!!!
They do not have a reasonable amount of flexibility,
If you want a RADIAL BASIS FUNCTION NET for regression or classification, use NEWRB!!!
Even NEWRB has many more deficiencies than FITNET(regression) and PATTERNNET(classification), however, I have shown how it can be used without too much frustration.
It has been some time since I've used it. SO, you will have to search for my posts and tutorials in the NEWSGROUP and ANSWERS.
Search backwards in both NEWSGROUP and ANSWERS using
greg newrb
Hope this helps.
Thank you for formally accepting my answer
Greg

3 件のコメント

Peter Peter
Peter Peter 2018 年 1 月 6 日
編集済み: Peter Peter 2018 年 1 月 6 日
I need a normalized radial basis function and newrb() gives funny results when I set transferFcn to ‘radbasn’ in the hidden layer
Greg Heath
Greg Heath 2018 年 1 月 6 日
I see you didn't read my newrb tutorial.
Peter Peter
Peter Peter 2018 年 1 月 7 日
I cannot find your tutorials in answers

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeDeep Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by