what command to predict class of test data using created KNNclassification model?

1 view (last 30 days)
i have a [1x1000] training vector and a categorical response variable resp;
ihave created KNNclassification model using the following code:
mdl = fitcknn(p,resp,'NumNeighbors',k,'distance','euclidean','kfold',5,'standardize',1);
i want to predict the class for the for each element of [1x1000] test vector t
i used the command:
y=predict(mdl,t)
its giving error:
Systems of classreg.learning.partition.ClassificationPartitionedModel class cannot be used with the "predict" command. Convert the
system to an identified model first, such as by using the "idss" command.
plz tell me how to solve this? which is the matlab command to achieve this?

Answers (1)

reem aldaihani
reem aldaihani on 17 Feb 2018
I got the same error and I don't know the answer. Hope someone can help us.

Community Treasure Hunt

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

Start Hunting!