liblinear--使用方法
- 1、主要用到的函数如下:
A、按照libsvm的数据格式读取txt文件 [label_vector, instance_matrix] = libsvmread('data.txt');
B、将数据写成SVM规定的形式 libsvmwrite('data.txt', label_vector, instance_matrix]
(The instance_matrix must be a sparse matrix. (type must be double))
C、训练函数 model = train(training_label_vector, training_instance_matrix [,'liblinear_options', 'col']);
-training_label_vector: An m by 1 vector of training labels. (type must be double)
-training_instance_matrix: An m by n matrix of m training instances with n features.
It must be a sparse matrix. (type must be double)
-liblinear_options:A string of training options in the same format as that of LIBLINEAR.
options:
-s type : set type of solver (default 1)
for multi-class classification
0 -- L2-regularized logistic regression (primal)
1 -- L2-regularized L2-loss support vector classification (dual)
2 -- L2-regularized L2-loss support vector classification (primal)
3 -- L2-regularized L1-loss support vector classification (dual)
4 -- support vector classification by Crammer and Singer
5 -- L1-regularized L2-loss support vector classification
6 -- L1-regularized logistic regression
7 -- L2-regularized logistic regression (dual)
for regression
11 -- L2-regularized L2-loss support vector regression (primal)
12 -- L2-regularized L2-loss support vector regression (dual)
13 -- L2-regularized L1-loss support vector regression (dual)
-c cost : set the parameter C (default 1)
-p epsilon : set the epsilon in loss function of epsilon-SVR (default 0.1)
-e epsilon : set tolerance of termination criterion
-s 0 and 2
|f'(w)|_2 <= epsmin(pos,neg)/l|f'(w0)|_2,
where f is the primal function and pos/neg are # of
positive/negative data (default 0.01)
-s 11
|f'(w)|_2 <= eps*|f'(w0)|_2 (default 0.001)
-s 1, 3, 4 and 7
Dual maximal violation <= eps; similar to libsvm (default 0.1)
-s 5 and 6
|f'(w)|_1 <= epsmin(pos,neg)/l|f'(w0)|_1,
where f is the primal function (default 0.01)
-s 12 and 13\n"
|f'(alpha)|_1 <= eps |f'(alpha0)|,
where f is the dual function (default 0.1)
-B bias : if bias >= 0, instance x becomes [x; bias]; if < 0, no bias term added (default -1)
-wi weight: weights adjust the parameter C of different classes (see README for details)
-v n: n-fold cross validation mode
-C : find parameter C (only for -s 0 and 2)
-q : quiet mode (no outputs)
-col:
if 'col' is set, each column of training_instance_matrix is a data instance. Otherwise each row is a data instance.
D、预测函数
[predicted_label, accuracy, decision_values/prob_estimates] = predict(testing_label_vector, testing_instance_matrix,model [, 'liblinear_options', 'col']);
- 2、示例:用liblinear自带的heart_scale做示例
[heart_scale_label, heart_scale_inst] = libsvmread('heart_scale'); %读数据
model=train(heart_scale_label, heart_scale_inst, '-c 1');
[predict_label, accuracy, dec_values] = predict(heart_scale_label, heart_scale_inst, model);
结果:Accuracy = 84.8148% (229/270)
寻优函数,对s=0或2
best = train(heart_scale_label, heart_scale_inst, '-C -s 0');
liblinear--使用方法相关推荐
- 在 Oracle Enterprise Linux 和 iSCSI 上构建您自己的 Oracle RAC 11g 集群
作者:Jeffrey Hunter 了解如何以低于 2,700 美元的费用在 Oracle Enterprise Linux 上安装并配置 Oracle RAC 11g 第 2 版开发集群. 本指南中 ...
- Java面试题大全2021版
一.Java 基础 JDK 和 JRE 有什么区别? JDK:Java Development Kit 的简称,java 开发工具包,提供了 java 的开发环境和运行环境. JRE:Java Run ...
- liblinear java_liblinear参数及使用方法(原创)
开发语言:JAVA liblinear版本:liblinear-1.94.jar (下载地址: 1.下载 liblinear-1.94.jar,导入工程 在工程上右键---->Propertie ...
- 如何使用GIST+LIBLINEAR分类器提取CIFAR-10 dataset数据集中图像特征,并用测试数据进行实验
上学期开了多媒体的课程,把其中一个课程设计实现的过程与大家分享. 转载请注明出处,谢谢. 最近整理文件的时候,发现了我以前写的文档和源码,附上github的下载地址 https://github.co ...
- LibLinear(SVM包)使用说明之(一)README
LibLinear(SVM包)使用说明之(一)README LibLinear(SVM包)使用说明之(一)README zouxy09@qq.com http://blog.csdn.net/zoux ...
- 【机器学习】基于实战项目的SVM算法库使用方法详解
0. 学习背景 本人在进行车道线检测项目中使用到了LBP+SVM算法来改善高复杂度场景下的车道线特征提取效果,主要流程如下:提取训练集中车道线的LBP特征,然后训练一个SVM分类器.在测试时,使用相同 ...
- ML之sklearn:sklearn.linear_mode中的LogisticRegression函数的简介、使用方法之详细攻略
ML之sklearn:sklearn.linear_mode中的LogisticRegression函数的简介.使用方法之详细攻略 目录 sklearn.linear_mode中的LogisticRe ...
- 【机器学习】集成模型方法
作者 | Salma Elshahawy, MSc. 编译 | VK 来源 | Towards Data Science 介绍 我们之前讨论了一些利用机器学习(ML)模型预测能力的常用方法.这些方法主 ...
- python中如何导入sklearn_Python中常用包——sklearn主要模块和基本使用方法
在从事数据科学的人中,最常用的工具就是R和Python了,每个工具都有其利弊,但是Python在各方面都相对胜出一些,这是因为scikit-learn库实现了很多机器学习算法. 加载数据(Data L ...
- Py之scikit-learn:机器学习sklearn库的简介、六大基本功能介绍(数据预处理/数据降维/模型选择/分类/回归/聚类)、安装、使用方法(实际问题中如何选择最合适的机器学习算法)之详细攻略
Py之scikit-learn:机器学习sklearn库的简介(组件/版本迭代).六大基本功能介绍(数据预处理/数据降维/模型选择/分类/回归/聚类).安装.使用方法(实际问题中如何选择最合适的机器学 ...
最新文章
- 【廖雪峰python入门笔记】tuple_创建单元素
- linux什么是实时调度,Linux中的实时调度
- HDOJ---1257 最少拦截系统[线性DP]+NYOJ---拦截导弹[输出最长单调子序列的长度]
- 1970.1.1这个特殊时间
- Binder实用指南(一) - 理解篇
- 常见的Content-Type类型
- LuoGu P2002 消息扩散
- scala 学习笔记--集合
- C#面向对象方式设置、读取应用配置
- HTML5是不是解决跨平台问题的终极密钥
- 用Resource Hacker辅助升级相关测试
- 741. 斐波那契数列
- ndk编译 toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe
- CentOS 安装火狐的 flash插件
- Android 融云单聊与群聊消息免打扰功能设置与消息删除功能实现
- 汽车行业消费者洞察|车载屏幕是否越大越多就越好?
- 碾压Dota2世界冠军的AI,被一小撮人持续干翻了
- BTC-Relay与RootStock侧链技术对比
- [九度][何海涛] 字符串的排序
- TMS320F28379D 使用心得之 SCI
热门文章
- 还是关于apk文件的反编译
- css:ios底部安全距离适配
- K线形态识别_黑三兵
- 云服务器 那个便宜亿点点
- mips linux 编译器,linux - MIPS的交叉编译器似乎无法创建有效的程序 - 堆栈内存溢出...
- chrome启用插件_如何在Chrome中启用离线浏览
- QT——使用QMediaPlayer播放视频
- 打破偏见,从花西子发现的新消费品牌真相
- 计算机审计实训实施阶段工作,计算机审计实训报告-20210525075352.docx-原创力文档...
- gis map数据包_arcgis mpk 打包地图 (数据管理)