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 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Ronny Guendel
il 19 Ott 2019
Risposto: Image Analyst
il 19 Ott 2019
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 Commenti
Risposta accettata
Image Analyst
il 19 Ott 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');
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Statistics and Machine Learning Toolbox in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!