SVM支持向量机

SVM指的是支持向量机(外文名Support Vector Machine),在机器学习领域,是一个有监督的学习模型,通常用来进行模式识别、分类以及回归分析。

Vapnik等人在多年研究统计学习理论基础上对线性分类器提出了另一种设计最佳准则。其原理也从线性可分说起,然后扩展到线性不可分的情况。甚至扩展到使用非线性函数中去,这种分类器被称为支持向量机(Support Vector Machine,简称SVM)。支持向量机的提出有很深的理论背景。
支持向量机方法是在后来提出的一种新方法。
SVM的主要思想可以概括为两点:
它是针对线性可分情况进行分析,对于线性不可分的情况,通过使用非线性映射算法将低维输入空间线性不可分的样本转化为高维特征空间使其线性可分,从而使得高维特征空间采用线性算法对样本的非线性特征进行线性分析成为可能。
它基于结构风险最小化理论之上再特征空间中构建最优超平面,使得学习器得到全局最优化,并且在整个样本空间的期望以某个概率满足一定上界。
⑴SVM学习问题可以表示为 凸优化问题,因此可以利用已知的有效算法发现目标函数的全局最小值。而其他分类方法(如基于规则的 分类器人工神经网络)都采用一种基于贪心学习的策略来搜索假设空间,这种方法一般只能获得局部最优解。
⑵SVM通过最大化决策边界的边缘来 控制模型的能力。尽管如此,用户必须提供其他参数,如使用 核函数类型和引入松弛变量等。
⑶通过对数据中每个分类属性引入一个 哑变量,SVM可以应用于分类数据。
⑷SVM一般只能用在二类问题,对于多类问题效果不好。

C/C++

Lush -- an Lisp-like interpreted/compiled language with C/C++/Fortran interfaces that haspackages to interface to a number of different SVM implementations. Interfaces to LASVM,LIBSVM,mySVM,SVQP,SVQP2 (SVQP3 in future) are available. Leverage these against Lush's other interfaces to machine learning,hidden markov models,numerical libraries (LAPACK,BLAS,GSL),and builtin vector/matrix/tensor engine.
SVMlight -- a popular implementation of the SVM algorithm by Thorsten Joachims; it can be used to solve classification,regression and ranking problems.
LIBSVM-- A Library for Support Vector Machines,Chih-Chung Chang and Chih-Jen Lin
YALE -- a powerful machine learning toolbox containing wrappers for SVMLight,LibSVM,and MySVM in addition to many evaluation and preprocessing methods.
LS-SVMLab - Matlab/C SVM toolbox - well-documented,many features
Gist -- implementation of the SVM algorithm with feature selection.
Weka -- a machine learning toolkit that includes an implementation of an SVM classifier; Weka can be used both interactively though a graphical interface or as a software library. (One of them is called "SMO". In the GUI Weka explorer,it is under the "classify" tab if you "Choose" an algorithm.)
OSU SVM - Matlab implementation based on LIBSVM
Torch - C++ machine learning library with SVMShogun - Large Scale Machine Learning Toolbox with interfaces to Octave,Matlab,Python,R
Spider - Machine learning library for Matlab
kernlab - Kernel-based Machine Learning library for R
TinySVM -- a small SVM implementation,written in C++

R

e1071 - Machine learning library for R

Matlab

SimpleSVM - SimpleSVM toolbox for Matlab
SVM and Kernel Methods Matlab Toolbox
PCP -- C program for supervised pattern classification. Includes LIBSVM wrapper.

python

numpy -fundamental package for scientific computing with Python
scipy -package of tools for science and engineering for Python

php

LibSVM 是SVM分类和回归问题的有效解决方案。这里的以php接口封装的svm扩展是为了在php脚本中更方便的应用。
SVM — The SVM class
SVM::__construct — Construct a new SVM object
SVM::crossvalidate — Test training params on subsets of the training data.
SVM::getOptions — Return the current training parameters
SVM::setOptions — Set training parameters
SVM::train — Create a SVMModel based on training data
SVMModel — The SVMModel class
SVMModel::checkProbabilityModel — Returns true if the model has probability information
SVMModel::__construct — Construct a new SVMModel
SVMModel::getLabels — Get the labels the model was trained on
SVMModel::getNrClass — Returns the number of classes the model was trained with
SVMModel::getSvmType — Get the SVM type the model was trained with
SVMModel::getSvrProbability — Get the sigma value for regression types
SVMModel::load — Load a saved SVM Model
SVMModel::predict_probability — Return class probabilities for previous unseen data
SVMModel::predict — Predict a value for previously unseen data
SVMModel::save — Save a model to a file
例如:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
 
$data  array (
 
     array (-1, 1 => 0.43, 3 => 0.12, 9284 => 0.2),
 
     array (1, 1 => 0.22, 5 => 0.01, 94 => 0.11),
 
);
 
 
$svm  new  SVM();
 
$model  $svm ->train( $data );
 
 
$data  array (1 => 0.43, 3 => 0.12, 9284 => 0.2);
 
$result  $model ->predict( $data );
 
var_dump( $result );
 
$model ->save( 'model.svm' );
 
?>
以上例程的输出类似于:
int(-1)


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值