Scikit-learn:分类classification
2017-08-14 00:00
183 查看
http://blog.csdn.net/pipisorry/article/details/53034340
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
如果之前设置了参数probability=True,则可以使用输出概率函数
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.
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.
使用示例
[sklearn.svm.SVC¶]
Scalable Linear Support Vector Machine for classification implemented using liblinear. Check the See also section of LinearSVC for more comparison element.
NuSVR
Support Vector Machine for regression implemented using libsvm using a parameter to control the number of support vectors.
[sklearn.svm]
皮皮blog
from: http://blog.csdn.net/pipisorry/article/details/53034340
ref:
支持向量机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. |
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_. |
使用示例
>>> 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
- Scikit-learn:分类classification
- scikit-learn 常用分类算法的使用
- 使用scikit-learn对车辆情况进行分类
- 【scikit-learn】【RandomForest】【GridSearchCV】二分类应用实例及【ROC】曲线绘制
- 22-用scikit-learn实现分类任务(感知机)
- 基于scikit-learn(sklearn)做分类--1.切词
- 用scikit-learn估计值分类——近邻算法(KNN)
- 应用scikit-learn做文本分类
- 转:30分钟学会用scikit-learn的基本分类方法(决策树、SVM、KNN)和集成方法(随机森林,Adaboost和GBRT)
- Python数据挖掘入门与实践(二)——用scikit-learn估计器分类
- 分类学习-支持向量机(Scikit-learn)
- 用scikit-learn和jieba支持中文文本特征提取和分类的测例
- 使用scikit-learn进行文本分类
- 基于scikit-learn(sklearn)做分类--2.分类
- scikit-learn分类问题入门实例(1)
- 使用scikit-learn处理分类的基础流程
- Python 文本分类:使用scikit-learn 机器学习包进行文本分类
- 基于scikit-learn(sklearn)做分类--3.优化--保存模型
- scikit-learn:0.4.构建文本分类的“pipeline”简化分类过程、网格搜索调参