how can I limit the search for kNN (fitcknn) if I have multiple classes in training but just want to compare the distance to few classes
1 回表示 (過去 30 日間)
古いコメントを表示
Hello to all,
how can I limit the classes to few selected.
suppose we have: Bending; Sitting; Standing; FAlling; Walking
in the training
but I just want to compare is it Bending or Walking
while i is the sample and m is the class (five in total) and x is the image
mdl_MD = fitcknn(P_train,movs(trainIdx),'NumNeighbors',3,'Distance','euclidean');
predict(P_train,P_test)
It computes the distance to all classes but I want the distance just to two as I said without computing a new .
I assume this must be possible with the functions fitcknn or predict, but how.
Thank you in advanced for your help.
0 件のコメント
採用された回答
Image Analyst
2019 年 10 月 19 日
Only pass in the columns you want, like
pTrain = movs(:, [1,4]); % Extract only bending and walking columns.
testData = movs(:, [1,4]); % Extract only bending and walking columns.
mdl_MD = fitcknn(pTrain,testData,'NumNeighbors',3,'Distance','euclidean');
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Statistics and Machine Learning Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!