MATLAB Answers


Is it possible , to use prediction with crossvalind

Asked by Subha
on 10 Mar 2013
Latest activity Commented on by Narges J
on 3 Sep 2014
Sir, with the given code i executed the program but it returns error.... i'm in need to calculate sensitivity and specificity also.. ... ??? Error using ==> subsindex Function 'subsindex' is not defined for values of class 'biolearning.classperformance'. .... so is it not possible for us to use crossvalind with ...
load target
load data
Indices = crossvalind('Kfold', GroupTrain,10);
cp1 = classperf(GroupTrain)
for i = 1:10
test = (Indices == i); train = ~test;
Bayes_Model =,:), GroupTrain(train,:), 'Distribution','kernel');
[Bayes_Predicted] = Bayes_Model.predict(data(test(cp1,1),:));
[conf, classorder] = confusionmat(target(test(c,1)),Bayes_Predicted);
.. waiting for valuable suggestion...


Sign in to comment.

1 Answer

Answer by Tom Lane
on 10 Mar 2013
 Accepted Answer

The error comes from this:
You're using cp1 to index into the logical vector test. I suspect you want something like
Then you may move on to the line where "c" is undefined, but perhaps you can take it from there.


Thanks a lot sir, now it works.. really helpful now i have another question too.. which i posed in
if i get answer for that too.. it will be really useful for me.. thanks ...
I wrote the code like above and did modification but I received this error:
Error using classreg.learning.internal.DisallowVectorOps/subsref (line 16) You cannot index into an object of class NaiveBayes using () indexing.
Error in classperf (line 219) gps = varargin{1}(:);
Please can you help me how I can solve it.
Thank you.

Sign in to comment.