error using classperf function
1 view (last 30 days)
Show older comments
I am working on neural network ,I want ti find the classifier performance,but i get error
Indices = crossvalind('Kfold',class1 , 10);cp = classperf(class1);
for i=1:10
test = (Indices == i);
trainn = ~test;
net = newff(inputs(:,trainn),targets(:,trainn),20,{},'trainscg');
net = train(net,res1(trainn),class1(trainn));
a = sim(net,res1(test));
% b=sim(net,inputs(:,test));
classperf(cp,a,test)
end
i have input as 4x30
error msg is
When the class labels of the CP object are numeric, the output of the classifier must be all non-negative integers or NaN's.
kindly assist
1 Comment
Greg Heath
on 7 Nov 2013
It would help immensely if you tried your code on MATLAB data:
help nndatasets.
Have you thought about including a non-training validation design set to prevent overtraining an overfit net?
What version are you using?
>> help newff newff Create a feed-forward backpropagation network.
Obsoleted in R2010b NNET 7.0. Last used in R2010a NNET 6.0.4.
Why NEWFF instead of the classification/pattern-recognition function NEWPR? Remember,as of 2010
NEWFIT/NEWPR/NEWFF ==> FITNET/PATTERNNET/FEEDFORWARDNET
I'll try your code on
help simpleclass_dataset
Greg
Accepted Answer
Greg Heath
on 8 Nov 2013
Edited: Greg Heath
on 8 Nov 2013
Why the RBF tag ??
SORRY. I cannot run your code because I have neither CROSSVALIND nor CLASSPERF.
HOWEVER, I understand the error message:
Your targets should be unit vectors containing only one "1" with the rest zeros. Regardless of the normalization used for training, unnormalized output values will be continuous over an interval [ -eps1, 1+eps2]. To get valid class indices use VEC2IND(a).
Hope this helps.
Thank you for formally accepting my answer
Greg
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!