To repair the error about classification

조회 수: 2 (최근 30일)
Frisda Sianipar
Frisda Sianipar 2021년 3월 23일
댓글: Star Strider 2021년 3월 24일
indices = crossvalind('Kfold',label,5);
cp=classperf(label);
for i = 1:5
test = (indices == i); train = ~test;
class =knnclassify(dim(test,:),dim(train,:),label(train,:),5,'euclidean', 'nearest');
classperf(cp,class,test)
end
cp.ErrorRate
The error:
Undefined function or variable 'label'.
Error in knn (line 1)
indices = crossvalind('Kfold',label,5);

채택된 답변

Star Strider
Star Strider 2021년 3월 23일
The ‘label’ variable must have been defined and must exist in your workspace before it is used as an argument to crossvalind.
  댓글 수: 7
Frisda Sianipar
Frisda Sianipar 2021년 3월 24일
I want to randomly share the data using the code using k-fold cross validation
Star Strider
Star Strider 2021년 3월 24일
I do not understand.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by