http://blog.csdn.net/pipisorry/article/details/53034340

支持向量机SVM分类

svm分类有多种不同的算法。SVM是非常流行的机器学习算法,主要用于分类问题,如同逻辑回归问题,它可以使用一对多的方法进行多类别的分类。

svc

Implementation of Support Vector Machine classifier using libsvm: the kernel can be non-linear but its SMO algorithm does not scale to large number of samples as LinearSVC does. Furthermore SVC multi-class mode is implemented using one vs one scheme while LinearSVC uses one vs the rest. It is possible to implement one vs the rest with SVC by using the sklearn.multiclass.OneVsRestClassifier wrapper. Finally SVC can fit dense data without memory copy if the input is C-contiguous. Sparse data will still incur memory copy though.

class sklearn.svm.SVC(C=1.0, kernel='rbf', degree=3, gamma='auto', coef0=0.0, shrinking=True, probability=False, tol=0.001, cache_size=200, class_weight=None, verbose=False, max_iter=-1, decision_function_shape=None, random_state=None)

常用参数

probability : boolean, optional (default=False)

Whether to enable probability estimates. This must be enabled priorto calling fit, and will slow down that method.

常用属性

coef_ : array, shape = [n_class-1, n_features]

常用方法Methods

decision_function(X) Distance of the samples X to the separating hyperplane.
fit(X, y[, sample_weight]) Fit the SVM model according to the given training data.
get_params([deep]) Get parameters for this estimator.
predict(X) Perform classification on samples in X.
score(X, y[, sample_weight]) Returns the mean accuracy on the given test data and labels.
set_params(**params) Set the parameters of this estimator.

如果之前设置了参数probability=True,则可以使用输出概率函数

predict_proba

Compute probabilities of possible outcomes for samples in X.

The model need to have probability information computed at trainingtime: fit with attribute probability set to True.

Parameters:

X : array-like, shape (n_samples, n_features)

For kernel=”precomputed”, the expected shape of X is[n_samples_test, n_samples_train]

Returns:

T : array-like, shape (n_samples, n_classes)

Returns the probability of the sample for each class inthe model. The columns correspond to the classes in sortedorder, as they appear in the attribute classes_.

Notes The probability model is created using cross validation, sothe results can be slightly different than those obtained bypredict. Also, it will produce meaningless results on very smalldatasets.

使用示例

>>> import numpy as np
>>> X = np.array([[-1, -1], [-2, -1], [1, 1], [2, 1]])
>>> y = np.array([1, 1, 2, 2])
>>> from sklearn.svm import SVC
>>> clf = SVC()
>>> clf.fit(X, y)
SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0,
    decision_function_shape=None, degree=3, gamma='auto', kernel='rbf',
    max_iter=-1, probability=False, random_state=None, shrinking=True,
    tol=0.001, verbose=False)
>>> print(clf.predict([[-0.8, -1]]))
[1]

[sklearn.svm.SVC¶]

LinearSVC

Implementation of Support Vector Machine classifier using the same library as this class (liblinear).
Scalable Linear Support Vector Machine for classification implemented using liblinear. Check the See also section of LinearSVC for more comparison element.

SVR

Support Vector Machine for Regression implemented using libsvm.

NuSVR

Support Vector Machine for regression implemented using libsvm using a parameter to control the number of support vectors.

LinearSVR

Scalable Linear Support Vector Machine for regression implemented using liblinear.

[sklearn.svm]

皮皮blog

from: http://blog.csdn.net/pipisorry/article/details/53034340

ref:

Scikit-learn:分类classification相关推荐

  1. scikit - learn 做文本分类

    文章来源: https://my.oschina.net/u/175377/blog/84420 Scikit Learn: 在python中机器学习 Warning 警告:有些没能理解的句子,我以自 ...

  2. Scikit Learn: 在python中机器学习

    Warning 警告:有些没能理解的句子,我以自己的理解意译. 翻译自:Scikit Learn:Machine Learning in Python 作者: Fabian Pedregosa, Ga ...

  3. [转载]Scikit Learn: 在python中机器学习

    原址:http://my.oschina.net/u/175377/blog/84420 目录[-] Scikit Learn: 在python中机器学习 载入示例数据 一个改变数据集大小的示例:数码 ...

  4. 【scikit-learn】如何用Python和SciKit Learn 0.18实现神经网络

    本教程的代码和数据来自于 Springboard 的博客教程.本文的作者为 Jose Portilla,他是网络教育平台 Udemy 一门数据科学类课程的讲师. GitHub 链接:https://g ...

  5. 机器学习与Scikit Learn学习库

    摘要: 本文介绍机器学习相关的学习库Scikit Learn,包含其安装及具体识别手写体数字案例,适合机器学习初学者入门Scikit Learn. 在我科研的时候,机器学习(ML)是计算机科学领域中最 ...

  6. python笔迹识别_python_基于Scikit learn库中KNN,SVM算法的笔迹识别

    之前我们用自己写KNN算法[网址]识别了MNIST手写识别数据 [数据下载地址] 这里介绍,如何运用Scikit learn库中的KNN,SVM算法进行笔迹识别. 数据说明: 数据共有785列,第一列 ...

  7. 分类(classification)是认知的基础、分类步骤及主要算法、分类与回归的区别、分类过程

    分类(classification)是认知的基础.分类步骤及主要算法.分类与回归的区别.分类过程 目录

  8. python scikit learn 关闭开源_Python机器学习工具:Scikit-Learn介绍与实践

    Scikit-learn 简介 官方的解释很简单: Machine Learning in Python, 用python来玩机器学习. 什么是机器学习 机器学习关注的是: 计算机程序如何随着经验积累 ...

  9. 机器学习笔记04:逻辑回归(Logistic regression)、分类(Classification)

    之前我们已经大概学习了用线性回归(Linear Regression)来解决一些预测问题,详见: 1.<机器学习笔记01:线性回归(Linear Regression)和梯度下降(Gradien ...

  10. python scikit learn 关闭开源_scikit learn 里没有神经网络?

    本教程的代码和数据来自于 Springboard 的博客教程,希望能为你提供帮助.作者为 Jose Portilla,他是网络教育平台 Udemy 一门数据科学类课程的讲师. GitHub 链接:ht ...

最新文章

  1. 获取input中的值
  2. 上传照片表单提交包括文本框下拉条等,如何取文本框的值
  3. 计算机转集成光学,集成光学
  4. bzoj 1684: [Usaco2005 Oct]Close Encounter【数学(?)】
  5. brctl 设置ip_Linux 网桥配置命令:brctl
  6. 【转】Android实例剖析笔记(二)--用实例讲解Andriod的开发过程,以NotesList为实例介绍Android的菜单机制...
  7. opencv之使用floodfill填充孔洞
  8. Git——版本回退【git reset / git log / git reflog】
  9. 苹果 M1 Mac 安装系统后创建用户失败的解决方法
  10. 如何在vue中使用阿里图标库
  11. [信号]预加重与去加重--转
  12. 朝花夕拾-不务正业的大学生做了什么比赛?
  13. mac 查看 本地网络代理
  14. 2015-点餐系统(服务器)
  15. iOS 14.5正式版如约而至 支持通过Apple Watch解锁iPhone
  16. 2020年TI杯大学生电子设计大赛 无线运动传感器节点 备赛、参赛实录(历时一个月)
  17. 元末明初为什么会爆发农民起义
  18. 商品3D建模的视觉定位和前景分割方法
  19. 操作系统实验二:物理内存管理系统
  20. 物联网通信协议-MQTT及使用python实现

热门文章

  1. Linux上层应用--Shell scripts基础规范
  2. 一步步学习SPD2010--第九章节--使用可重用工作流和工作流表单(13)--修改任务表单...
  3. VSCode 写python,打印中文输出乱码
  4. 下载devc++和codeblocks记录
  5. mysql优化--explain分析sql语句执行效率
  6. c# combobox 绑定枚举方式
  7. HTTP协议&SOCKET协议
  8. 如果创建表提示数据库已经存在该对象,那该怎么办
  9. Codeforces Round #224 (Div. 2)
  10. PHP面试题及答案(一)