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 vue (au cours des 30 derniers jours)
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.

Réponse acceptée

Image Analyst
Image Analyst le 19 Oct 2019
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');

Plus de réponses (0)

Catégories

En savoir plus sur Statistics and Machine Learning Toolbox dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by