葡萄酒支持向量机SVM分类

  • t2_345327
    了解作者
  • 673B
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-05-25 10:03
    上传日期
采用支持向量机SVM分类葡萄酒,完整代码,无错误,下载即可运行。
新建文件夹.zip
  • 新建文件夹
  • svm.m
    889B
内容介绍
clear all; clc; fid = fopen('C:\Users\hh\Desktop\shuju\chuli\t.txt'); wine=fid; train_wine = [wine(1:20,:);wine(36:55,:)]; train_wine_labels = [wine_labels(1:20);wine_labels(36:55);]; test_wine = [wine(21:35,:);wine(56:70,:)]; test_wine_labels = [wine_labels(21:35);wine_labels(56:70)]; [train_wine,pstrain] = mapminmax(train_wine'); pstrain.ymin = 0; pstrain.ymax = 1; [train_wine,pstrain] = mapminmax(train_wine,pstrain); [test_wine,pstest] = mapminmax(test_wine'); pstest.ymin = 0; pstest.ymax = 1; [test_wine,pstest] = mapminmax(test_wine,pstest); train_wine = train_wine'; test_wine = test_wine'; [bestacc,bestc,bestg] = SVMcg(train_wine_labels,train_wine,-2,4,-4,4,3,0.5,0.5,0.9); cmd = ['-c ',num2str(bestc),' -g ',num2str(bestg)]; model = svmtrain(train_wine_labels,train_wine,cmd); [pre,acc] = svmpredict(test_wine_labels,test_wine,model);
评论
    相关推荐