matlab打开README文件,有答案。我的是libsvm3.22。每个版本不一样的

Train and test on the provided data heart_scale:

matlab> [heart_scale_label, heart_scale_inst] = libsvmread('../heart_scale');

matlab> model = svmtrain(heart_scale_label, heart_scale_inst, '-c 1 -g 0.07');

matlab> [predict_label, accuracy, dec_values] = svmpredict(heart_scale_label, heart_scale_inst, model); % test the training data

For probability estimates, you need '-b 1' for training and testing:

matlab> [heart_scale_label, heart_scale_inst] = libsvmread('../heart_scale');

matlab> model = svmtrain(heart_scale_label, heart_scale_inst, '-c 1 -g 0.07 -b 1');

matlab> [heart_scale_label, heart_scale_inst] = libsvmread('../heart_scale');

matlab> [predict_label, accuracy, prob_estimates] = svmpredict(heart_scale_label, heart_scale_inst, model, '-b 1');

To use precomputed kernel, you must include sample serial number as

the first column of the training and testing data (assume your kernel

matrix is K, # of instances is n):

matlab> K1 = [(1:n)', K]; % include sample serial number as first column

matlab> model = svmtrain(label_vector, K1, '-t 4');

matlab> [predict_label, accuracy, dec_values] = svmpredict(label_vector, K1, model); % test the training data

We give the following detailed example by splitting heart_scale into

150 training and 120 testing data.  Constructing a linear kernel

matrix and then using the precomputed kernel gives exactly the same

testing error as using the LIBSVM built-in linear kernel.

matlab> [heart_scale_label, heart_scale_inst] = libsvmread('../heart_scale');

matlab>

matlab> % Split Data

matlab> train_data = heart_scale_inst(1:150,:);

matlab> train_label = heart_scale_label(1:150,:);

matlab> test_data = heart_scale_inst(151:270,:);

matlab> test_label = heart_scale_label(151:270,:);

matlab>

matlab> % Linear Kernel

matlab> model_linear = svmtrain(train_label, train_data, '-t 0');

matlab> [predict_label_L, accuracy_L, dec_values_L] = svmpredict(test_label, test_data, model_linear);

matlab>

matlab> % Precomputed Kernel

matlab> model_precomputed = svmtrain(train_label, [(1:150)', train_data*train_data'], '-t 4');

matlab> [predict_label_P, accuracy_P, dec_values_P] = svmpredict(test_label, [(1:120)', test_data*train_data'], model_precomputed);

matlab>

matlab> accuracy_L % Display the accuracy using linear kernel

matlab> accuracy_P % Display the accuracy using precomputed kernel

Note that for testing, you can put anything in the

testing_label_vector.  For more details of precomputed kernels, please

read the section ``Precomputed Kernels'' in the README of the LIBSVM

package.

matlab heart scale,matlab下libsvm测试heart_scale的问题相关推荐

  1. Matlab R2016b 版本配置+安装LIBSVM 呕心沥血整理全集

    Matlab R2016b 版本配置+安装LIBSVM 呕心沥血整理全集 目录 前言 LIBSVM安装包下载 安装编译器 测试安装是否成功 编译文件 测试使用 本文中参考到的博文 后记 前言 (一些废 ...

  2. matlab开发环境,Windows 下开源开发环境的搭建

    因项目需要在 Windows 下测试开发的程序, 所以研究了一下如何在 Windows 下搭建基于 gcc 的开源开发环境. MSYS2 是 Windows 下的一款开源软件构建和发布平台, 网址为  ...

  3. Modelsim联合Matlab进行FPGA图像处理仿真与测试的学习总结(以RGB转Ycbcr转Gray为例)

    文章目录 一.Modelsim联合Matlab进行FPGA图像仿真的步骤 二.具体实现方法 2.1 新建一个Modelsim项目并编写测试代码 2.2 新建v文件来编写待测试代码 2.3 建成项目后, ...

  4. matlab文件夹内文件数目_【笔记】MATLAB遍历文件夹下的文件

    做测试,离不开的是数据的整理和归档.最近在做相机底片辐射定标的时候得到的一组测试结果,为了测试结果的整齐,测试人员(算我一个)把结果分装在了200多个子文件夹,而这200多个子文件夹又分装在5个不同的 ...

  5. am传输系统matlab,基于MATLAB的模拟调制系统仿真及测试(AM调制)

    闽江学院 <通信原理设计报告> 题 目:基于MATLAB的模拟调制系统仿真与测试 学 院:计算机科学系 专 业:12通信工程 组 长:曾锴(3121102220) 组 员:薛兰兰(3121 ...

  6. matlab读取文件夹下所有文件的字符串,MATLAB读取文件夹下所有文件的文件名并读取数据...

    MATLAB读取文件夹下特定类型格式文件的文件名并读取该格式文件的数据 利用代码对大量数据进行自动批处理时,首先需要获取该数据存放的文件夹(文件夹路径),然后获取该文件夹下某一类型数据所有的文件名,最 ...

  7. matlab分析机翼,基于Matlab对机翼断面下轮廓线的数值分析

    <基于Matlab对机翼断面下轮廓线的数值分析>由会员分享,可在线阅读,更多相关<基于Matlab对机翼断面下轮廓线的数值分析(4页珍藏版)>请在人人文库网上搜索. 1.基于M ...

  8. MATLAB学习笔记2:MATLAB基础知识(下)

    阅读前请注意: 1. 该学习笔记是华中师范大学HelloWorld程序设计协会2021年寒假MATLAB培训的学习记录,是基于培训课堂内容的总结归纳.拓展阅读.博客内容由 @K2SO4钾 撰写.编辑, ...

  9. matlab节点连通率,利用matlab仿真最小发射功率下wsn的连通性和覆盖率.docx

    利用matlab仿真最小发射功率下wsn的连通性和覆盖率.docx 江南大学物联网ZK1/5一题目利用MATLAB仿真最小发射功率下WSN的连通性和覆盖率.二目的(1)在固定节点个数的前提下,仿真求得 ...

最新文章

  1. Tokyo Tyrant基本规范(4)--协议
  2. C++构造函数和析构函数调用虚函数时都不会使用动态联编
  3. 复随机变量及高斯熵的概念
  4. java wcf 未提供用户名_WCF安全之自定义用户名密码验证方式 | 学步园
  5. WebRTC编译系统之GYP,gn和ninja
  6. STM32 RS485 和串口 只能接收不能发送问题解决
  7. Python 打开文件注意事项
  8. 如何在Linux上部署Jenkins
  9. wechat.php+获取昵称,微信后台代码,获取用户昵称
  10. 贷后模块之催收行为综合评分卡
  11. 《SpringBoot实战》笔记2
  12. 微博清理多个百万粉丝大号:打击违规账号要命中七寸
  13. 留学生Essay写作没思路的解决方案
  14. 上海拍照攻略,让你的朋友圈与众不同
  15. 为啥Java程序员工资高,却很多人想转行,这4点原很现实
  16. 文本分类上分利器: Bert微调trick大全
  17. 在wget中指定代理服务器
  18. mezzanine timezone 的问题
  19. 麦芽糖-刀豆球蛋白A,maltose-ConcanavalinA,刀豆球蛋白A-PEG-麦芽糖
  20. 解决误删Android系统的tmp目录

热门文章

  1. 今日,秋分。2021
  2. 学习记录553@flowable候选人机制
  3. 高级工程师面试 - MySQL
  4. python dll_python3.dll,下载,简介,描述,修复,等相关问题一站搞定_DLL之家
  5. 使用BeautifulSoup爬网页指定内容
  6. 神秘代码alpha191的终极打开方式
  7. 学校信息计算机教案百度文库,人教版信息技术教案 八年级下册_百度文库(45页)-原创力文档...
  8. java 实现树形结构
  9. Trajectory Forecasting:TrajNet++
  10. 网络数据安全法解读第三篇