zoukankan      html  css  js  c++  java
  • 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
    

      

  • 相关阅读:
    文件操作
    数据补充
    小数据池
    列表
    基础知识1
    我的Python之旅开始
    正则
    模块
    迭代器与生成器
    文件操作
  • 原文地址:https://www.cnblogs.com/xiangshancuizhu/p/2151727.html
Copyright © 2011-2022 走看看