error using classperf function

1 次查看(过去 30 天)
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 个评论
Greg Heath
Greg Heath 2013-11-7
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

请先登录,再进行评论。

采纳的回答

Greg Heath
Greg Heath 2013-11-8
编辑:Greg Heath 2013-11-8
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 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by