Scikit-learn:分类classification
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.
from: http://blog.csdn.net/pipisorry/article/details/53034340
ref:
Scikit-learn:分类classification的更多相关文章
- scikit learn 模块 调参 pipeline+girdsearch 数据举例:文档分类 (python代码)
scikit learn 模块 调参 pipeline+girdsearch 数据举例:文档分类数据集 fetch_20newsgroups #-*- coding: UTF-8 -*- import ...
- (原创)(四)机器学习笔记之Scikit Learn的Logistic回归初探
目录 5.3 使用LogisticRegressionCV进行正则化的 Logistic Regression 参数调优 一.Scikit Learn中有关logistics回归函数的介绍 1. 交叉 ...
- Scikit Learn: 在python中机器学习
转自:http://my.oschina.net/u/175377/blog/84420#OSC_h2_23 Scikit Learn: 在python中机器学习 Warning 警告:有些没能理解的 ...
- CVPR 2013 关于图像/场景分类(classification)的文章paper list
CVPR 2013 关于图像/场景分类(classification)的文章paper list 八14by 小军 这个搜罗了cvpr2013有关于classification的相关文章,自己得m ...
- W3School-CSS 分类 (Classification) 实例
CSS 分类 (Classification) 实例 CSS 实例 CSS 背景实例 CSS 文本实例 CSS 字体(font)实例 CSS 边框(border)实例 CSS 外边距 (margin) ...
- (原创)(三)机器学习笔记之Scikit Learn的线性回归模型初探
一.Scikit Learn中使用estimator三部曲 1. 构造estimator 2. 训练模型:fit 3. 利用模型进行预测:predict 二.模型评价 模型训练好后,度量模型拟合效果的 ...
- CSS 分类 (Classification) 实例
CSS 分类 (Classification) 实例CSS 分类属性 (Classification)CSS 分类属性允许你控制如何显示元素,设置图像显示于另一元素中的何处,相对于其正常位置来定位元素 ...
- Scikit Learn
Scikit Learn Scikit-Learn简称sklearn,基于 Python 语言的,简单高效的数据挖掘和数据分析工具,建立在 NumPy,SciPy 和 matplotlib 上.
- 机器学习-scikit learn学习笔记
scikit-learn官网:http://scikit-learn.org/stable/ 通常情况下,一个学习问题会包含一组学习样本数据,计算机通过对样本数据的学习,尝试对未知数据进行预测. 学习 ...
随机推荐
- win10下 github+hexo搭建个人博客.md
我的博客地址 https://chenxianfu.github.io/ 遇到的坑 hexo 问题 4000端口打不开,可能端口占用,请输入一下命令 hexo server -p 4001 针对很多人 ...
- 拥抱开源,Office 365开发迎来新时代
前言 作为全球最大的开放源代码托管平台,Github在上周迎来了它的十岁生日.自从2008年正式上线以来,Github上面汇聚了数以千万计的开发人员和各种项目,它几乎成为了开源的代名词和风向标,各大软 ...
- Java数据类型与SQL数据类型的映射
Java数据类型与SQL数据类型的映射 SQL Data Type Java Data Type char/varchar/longvarchar String numeric/decimal jav ...
- Struts2--拦截器Interceptor
拦截器是的我们可以在方法的执行前后定义执行的操作.可以作为一个非常有力的工具在数据验证,属性设置,安全,日志等等方面. 拦截器可以链接起来形成一个拦截器栈.框架会按照拦截器定义的顺序依次调用这些拦截器 ...
- [HNOI 2014]江南乐
Description 题库链接 给你指定一个数 \(f\) ,并给你 \(T\) 组游戏,每组有 \(n\) 堆石子, \(A,B\) 两人轮流对石子进行操作,每次你可以选择其中任意一堆数量不小于 ...
- [JSOI2007]文本生成器
题目描述 JSOI交给队员ZYX一个任务,编制一个称之为“文本生成器”的电脑软件:该软件的使用者是一些低幼人群,他们现在使用的是GW文本生成器v6版. 该软件可以随机生成一些文章―――总是生成一篇长度 ...
- [HNOI2007]分裂游戏
Description 聪聪和睿睿最近迷上了一款叫做分裂的游戏. 该游戏的规则试: 共有 n 个瓶子, 标号为 0,1,2.....n-1, 第 i 个瓶子中装有 p[i]颗巧克力豆,两个人轮流取豆子 ...
- 2015 多校联赛 ——HDU5348(搜索)
Problem Description As we all kown, MZL hates the endless loop deeply, and he commands you to solve ...
- 树莓派超声波测距+蜂鸣器(c语言)
前边我们已经详细的讲解了树莓派控制超声波模块测距(http://www.cnblogs.com/yuemo/p/8888342.html)和超声波控制蜂鸣器模块发声(http://www.cnblog ...
- Python Django rest framework
本节内容 Django rest framework 安装 Django rest framwwork 环境配置 简单举例说明 Django中使用 rest framework 1.1 安装 Djan ...