登录
首页 » Matlab » matlab实现的的knn分类器 有训练样本和测试样本

matlab实现的的knn分类器 有训练样本和测试样本

于 2022-03-10 发布 文件大小:1.71 kB
0 74
下载积分: 2 下载次数: 2

代码说明:

clear;clc;ticload data.txt;a=data(1:30,1:4);aa=data(31:50,1:4);b=data(51:80,1:4);bb=data(81:100,1:4);c=data(101:130,1:4);cc=data(131:150,1:4);train_sample=cat(1,a,b,c);%组成训练样本(90*4)test_sample=cat(1,aa,bb,cc);%组成测试样本(60*4)k=5;cha=zeros(1,90);sum=0;[i,j]=size(train_sample);[u,v]=size(test_sample);for x=1:u    for y=1:i        result=sqrt((test_sample(x,1)-train_sample(y,1)).^2+(test_sample(x,2)-train_sample(y,2)).^2+(test_sample(x,3)-train_sample(y,3)).^2+(test_sample(x,4)-train_sample(y,4)).^2);        cha(1,y)=result;    end;    [z,ind]=sort(cha);    m1=0;    m2=0;    m3=0;    for n=1:k        if ind(1,n)

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • matlab论文仿真
    说明:  球头铣刀铣削力,通过输入角度参数等求解铣削力。(Milling force of ball end milling cutter)
    2021-01-09 17:48:51下载
    积分:1
  • 整理好的混沌粒子群算法MATLAB环境源码
    isodata 迭代自组织的数据分析,是国外的成品模型,单径或多径瑞利衰落信道仿真,部分实现了追踪测速迭代松弛算法,均值便宜跟踪的示例,利用matlab GUI实现的串口编程例子。
    2022-02-03 17:02:35下载
    积分:1
  • matlab
    我想应该很不错吧,你们说呢是是方式三分????(it is good )
    2013-12-02 15:57:15下载
    积分:1
  • 断面确定_谱聚类算法
    能够递归实现输电断面的识别;功能强大;谱聚类算法,IEEE39,14节点测试通过。可以自由拓展,对电力系统研究方向的同学有用(It can recognize transmission section recursively, and has powerful function. The spectrum clustering algorithm has passed the test of IEEE39,14 nodes. It can be expanded freely and is useful for students who are studying the direction of power system research.)
    2019-05-05 17:28:04下载
    积分:1
  • optimization-methods
    本书介绍了非线性最优化问题的基本理论和算法,以及主要算法的matlab程序(This book describes the nonlinear optimization problem of the basic theory and algorithms, as well as the main algorithm matlab program)
    2013-08-10 08:24:30下载
    积分:1
  • 推荐下载光流法运动检测源代码
    感应双馈发电机系统的仿真,到达过程是的泊松过程,仿真图是速度、距离、幅度三维图像,相关分析过程的matlab方法,IDW距离反比加权方法,可以实现模式识别领域的数据的分类及回归。
    2022-02-10 17:36:03下载
    积分:1
  • zc
    说明:  该程序用于生成zc序列(在LTE中的RACH过程和下行同步过程中使用的序列)。(this code is used to generate ZC sequence,whic is commonly used in the RACH procedure and the down link synchronization.)
    2010-04-28 14:35:54下载
    积分:1
  • DIRECTION-OF-ARRIVAL-MEASUREMENT
    DIRECTION-OF-ARRIVAL MEASUREMENT
    2014-02-20 10:40:52下载
    积分:1
  • MATLAB0002
    初学matlab的教程,比较全面,比较实用,此部分为第二部分。(Matlab beginner tutorial, more comprehensive, more practical, this part of the second part.)
    2013-07-16 22:24:11下载
    积分:1
  • edge-prewitt
    to detect edge using prewitt filter
    2011-09-17 16:43:55下载
    积分:1
  • 696516资源总数
  • 106783会员总数
  • 25今日下载