matlab自带knnclssify小实验
an for the object of samplify, i only choose 3 classes while 2 samples for each class ,there are 18 features in every sample .
train_data=load('E:\sample_feature.txt');
train_label=load('E:\train_label.txt');
test_data=load('E:\features.txt');
k=knnclassify(test_data,train_data,train_label,3,'cosine','random');
the train_label is like this :
1 1 2 2 3 3
and the classified result is :
k =
     3
     3
     3
     3
     2
     3
     3
     1
     3
     3
     3
     2
     2
     3
     1
     3
     3
     3
     3
     3
     3
     3
     3
     3
     3
     3
     3
     3
     3
     1
     3
     3
     3
     3
     3
     3
     3
     3
     3
     3
     2
     3
     3
     1
     3
     3
     3
     1
     3
     1
     3
     3
     1
     3
     1
     2
     3
     3
     3
     1
     2
     1
     3
     2
     1
     3
     2
     1
     3
     2
     2
     3
 
                    
                
 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号