fisher isis, train a knn classifier. Create trainning and test set.
Show older comments
Hello. I want to train a Knn classifier (k=1, k=3, k=5) for fisher iris data. I want randomly to take the 120 of 150 for training set and the rest for testing. But randomly each time. I wrote this code
load fisheriris
randSamples = meas(randperm(size(meas, 1)), :);
trainingSet = randSamples((1:120), :);
testSet = randSamples((121:150), :);
But for fisher iris, the vector with the species should be change in the same way? how can i do this? in the command
dl = fitcknn(meas,species,'NumNeighbors',5,'Standardize',1);
i need 2 vectors with same count of rows. Any further help about knn would be useful. thanks in advance
Answers (1)
Star Strider
on 15 Jan 2016
0 votes
I can’t improve on the documentation example!
Categories
Find more on Classification in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!