ImageVerifierCode 换一换
格式:DOCX , 页数:73 ,大小:31.15KB ,
资源ID:5840865      下载积分:1 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bingdoc.com/d-5840865.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(课程设计模式识别大作业Word格式文档下载.docx)为本站会员(b****1)主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(发送邮件至service@bingdoc.com或直接QQ联系客服),我们立即给予删除!

课程设计模式识别大作业Word格式文档下载.docx

1、void randd3(double A6,double test7);void rand4(double A6,double study6);void randd4(double A6,double test7);void rand5(double A6,double study6);void randd5(double A6,double test7);void SEARCH(double A,int low,int high);void OUTPUT(double test7,FILE *fp); double MAX(double t1,double t2,double t3);dou

2、ble distance(int i,int j,double sample6,double test7);/主程序:void main() char s100; double A1506; int i,j; double study606; /学习样本 double test907; /测试样本 FILE *fp; if(fp=fopen(Iris.txt,r)=NULL) printf(cannot open file n); exit(0); fgets(s,100,fp); for(i=0;i150;i+) for(j=0;j6;j+) fscanf(fp,%lf,&Aij); /读取

3、样本集存入A fclose(fp); fp=fopen(Classification Outputs (k=7).docw/建立“分类结果(k=5).doc”文档存放分类结果 fprintf(fp,nThe first output:n rand1(A,study); /初始化数组study randt1(A,test); /初始化数组test RESULT(A,study,test); /RESULT聚类 OUTPUT(test,fp); /输出聚类结果并计算正确率 nThe second output: rand2(A,study); randd2(A,test);nThe third o

4、utput: rand3(A,study); randd3(A,test);The fourth output: rand4(A,study); randd4(A,test);The fifth output: rand5(A,study); randd5(A,test);/K近邻算法得到分类结果:void RESULT(double A6,double study6,double test7) int i,j,t; double u; double t1,t2,t3; double temp60; double mk; double D9060;90;i+)60; Dij=distance(

5、i,j,study,test); t1=0;t2=0;t3=0; tempj=Dij; SEARCH(temp,0,59); for(t=0;tk;t+) for(j=0; if(tempt=Dij) mt=j; if(study(int)mt5=1.0) t1+; else if(study(int)mt5=2.0) t2+; else t3+; u=MAX(t1,t2,t3); testi6=u;/初始化样本集及测试集:void rand1(double A6,double study6)20; studyij=Aij; studyi+20j=Ai+50j; studyi+40j=Ai+1

6、00j;void randt1(double A6,double test7) for(i=20;50; testi-20j=Aij; testi+10j=Ai+50j; testi+40j=Ai+100j;void rand2(double A6,double study6) for(i=10;30; studyi-10j=Aij; studyi+10j=Ai+50j; studyi+30j=Ai+100j;void randd2(double A6,double test7)10; testij=Aij; testi+20j=Ai+100j; for(i=30; testi+20j=Ai+

7、30j; testi+40j=Ai+60j;void rand3(double A6,double study6)40; studyi-20j=Aij; studyij=Ai+50j; studyi+20j=Ai+100j;void randd3(double A6,double test7) testi+20j=Ai+50j; for(i=40; testi+20j=Aij; testi+30j=Ai+50j;void rand4(double A6,double study6) studyi-30j=Aij; studyi-10j=Ai+50j; studyi+10j=Ai+100j;vo

8、id randd4(double A6,double test7) testi+60j=Ai+100j;void rand5(double A6,double study6) studyi+10j=Ai+40j; studyi+30j=Ai+90j; studyi+50j=Ai+140j;void randd5(double A6,double test7) testi-10j=Aij; testi+50j=Ai+100j;/搜索检验位置样本x的最近邻是否存在:void SEARCH(double A,int low,int high) int i=low; int j=high; doubl

9、e pivot=Alow; while (ij) while(i=pivot) j-; Ai=Aj;Ai i+; Aj=Ai; Ai=pivot; if(lowi+1) SEARCH(A,i+1,high);/结果输出聚类结果及正确率:void OUTPUT(double test7,FILE *fp) int i,j,n=0;7; fprintf(fp,%lf ,testij); fprintf(fp, if(testi6=testi5) n+;正确率%lfn,n/90.0);/找最大值double MAX(double t1,double t2,double t3) if(t1=t2&t1

10、=t3) return 1; else if(t2=t3&t2=t1) return 2; else return 3;/求距离函数double distance(int i,int j,double sample6,double test7) int m; double s=0; for(m=1;m4;m+) s+=pow(testim-samplejm,2); s=sqrt(s); return s;附:k=7时归类结果The first result:21.000000 5.400000 3.400000 1.700000 0.200000 1.000000 1.000000 22.00

11、0000 5.100000 3.700000 1.500000 0.400000 1.000000 1.000000 23.000000 4.600000 3.600000 1.000000 0.200000 1.000000 1.000000 24.000000 5.100000 3.300000 1.700000 0.500000 1.000000 1.000000 25.000000 4.800000 3.400000 1.900000 0.200000 1.000000 1.000000 26.000000 5.000000 3.000000 1.600000 0.200000 1.0

12、00000 1.000000 27.000000 5.000000 3.400000 1.600000 0.400000 1.000000 1.000000 28.000000 5.200000 3.500000 1.500000 0.200000 1.000000 1.000000 29.000000 5.200000 3.400000 1.400000 0.200000 1.000000 1.000000 30.000000 4.700000 3.200000 1.600000 0.200000 1.000000 1.000000 31.000000 4.800000 3.100000 1

13、.600000 0.200000 1.000000 1.000000 32.000000 5.400000 3.400000 1.500000 0.400000 1.000000 1.000000 33.000000 5.200000 4.100000 1.500000 0.100000 1.000000 1.000000 34.000000 5.500000 4.200000 1.400000 0.200000 1.000000 1.000000 35.000000 4.900000 3.100000 1.500000 0.200000 1.000000 1.000000 36.000000

14、 5.000000 3.200000 1.200000 0.200000 1.000000 1.000000 37.000000 5.500000 3.500000 1.300000 0.200000 1.000000 1.000000 38.000000 4.900000 3.600000 1.400000 0.100000 1.000000 1.000000 39.000000 4.400000 3.000000 1.300000 0.200000 1.000000 1.000000 40.000000 5.100000 3.400000 1.500000 0.200000 1.00000

15、0 1.000000 41.000000 5.000000 3.500000 1.300000 0.300000 1.000000 1.000000 42.000000 4.500000 2.300000 1.300000 0.300000 1.000000 1.000000 43.000000 4.400000 3.200000 1.300000 0.200000 1.000000 1.000000 44.000000 5.000000 3.500000 1.600000 0.600000 1.000000 1.000000 45.000000 5.100000 3.800000 1.900

16、000 0.400000 1.000000 1.000000 46.000000 4.800000 3.000000 1.400000 0.300000 1.000000 1.000000 47.000000 5.100000 3.800000 1.600000 0.200000 1.000000 1.000000 48.000000 4.600000 3.200000 1.400000 0.200000 1.000000 1.000000 49.000000 5.300000 3.700000 1.500000 0.200000 1.000000 1.000000 50.000000 5.0

17、00000 3.300000 1.400000 0.200000 1.000000 1.000000 71.000000 5.900000 3.200000 4.800000 1.800000 2.000000 2.000000 72.000000 6.100000 2.800000 4.000000 1.300000 2.000000 2.000000 73.000000 6.300000 2.500000 4.900000 1.500000 2.000000 2.000000 74.000000 6.100000 2.800000 4.700000 1.200000 2.000000 2.

18、000000 75.000000 6.400000 2.900000 4.300000 1.300000 2.000000 2.000000 76.000000 6.600000 3.000000 4.400000 1.400000 2.000000 2.000000 77.000000 6.800000 2.800000 4.800000 1.400000 2.000000 2.000000 78.000000 6.700000 3.000000 5.000000 1.700000 2.000000 3.000000 79.000000 6.000000 2.900000 4.500000

19、1.500000 2.000000 2.000000 80.000000 5.700000 2.600000 3.500000 1.000000 2.000000 2.000000 81.000000 5.500000 2.400000 3.800000 1.100000 2.000000 2.000000 82.000000 5.500000 2.400000 3.700000 1.000000 2.000000 2.000000 83.000000 5.800000 2.700000 3.900000 1.200000 2.000000 2.000000 84.000000 6.00000

20、0 2.700000 5.100000 1.600000 2.000000 3.000000 85.000000 5.400000 3.000000 4.500000 1.500000 2.000000 2.000000 86.000000 6.000000 3.400000 4.500000 1.600000 2.000000 2.000000 87.000000 6.700000 3.100000 4.700000 1.500000 2.000000 2.000000 88.000000 6.300000 2.300000 4.400000 1.300000 2.000000 2.0000

21、00 89.000000 5.600000 3.000000 4.100000 1.300000 2.000000 2.000000 90.000000 5.500000 2.500000 4.000000 1.300000 2.000000 2.000000 91.000000 5.500000 2.600000 4.400000 1.200000 2.000000 2.000000 92.000000 6.100000 3.000000 4.600000 1.400000 2.000000 2.000000 93.000000 5.800000 2.600000 4.000000 1.20

22、0000 2.000000 2.000000 94.000000 5.000000 2.300000 3.300000 1.000000 2.000000 2.000000 95.000000 5.600000 2.700000 4.200000 1.300000 2.000000 2.000000 96.000000 5.700000 3.000000 4.200000 1.200000 2.000000 2.000000 97.000000 5.700000 2.900000 4.200000 1.300000 2.000000 2.000000 98.000000 6.200000 2.900000 4.300000 1.300000 2.000000 2.000000 99.000000 5.100000 2.500000 3.000000 1.100000 2.000000 2.000

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2