• 支持向量机--svm.SVC类


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

    参数

    C

    float, default=1.0
    正则化参数。正则化程度与C成反比,必须严格保持积极,该惩罚项是I2的开平方

    Regularization parameter. The strength of the regularization is inversely proportional to C. Must be strictly positive. The penalty is a squared l2 penalty.

    kernel

    {‘linear’, ‘poly’, ‘rbf’, ‘sigmoid’, ‘precomputed’} or callable, default=’rbf’
    指定算法所使用的内核函数类型,默认rdf
    如果该参数为可迭代类型,它的维度必须是(n_samples, n_samples).,它将用来从数据矩阵中预先计算得到核矩阵

    Specifies the kernel type to be used in the algorithm. If none is given, ‘rbf’ will be used. If a callable is given it is used to pre-compute the kernel matrix from data matrices; that matrix should be an array of shape (n_samples, n_samples).

    可选值描述
    linear线性函数
    ploy多项式核函数
    rbf高斯核函数(默认
    sigmoidsigmoid函数
    precomputed

    degree

    int, default=3
    多项式核函数的阶数,仅当参数kernel='poly’时有效

    Degree of the polynomial kernel function (‘poly’). Ignored by all other kernels.

    gamma

    {‘scale’, ‘auto’} or float, default=’scale’
    核系数

    Kernel coefficient for ‘rbf’, ‘poly’ and ‘sigmoid’.

    可选值该参数取值
    scale1 / (n_features * X.var())
    auto1/n_features
    float

    coef0

    float, default=0.0
    核函数的独立期限,(当参数kernel=‘poly’,'sigmoid’时生效)

    Independent term in kernel function. It is only significant in ‘poly’ and ‘sigmoid’.

    shrinking

    bool, default=True
    是否使用启发式收缩

    Whether to use the shrinking heuristic

    probability

    bool, default=False
    是否启用概率估计

    Whether to enable probability estimates. This must be enabled prior to calling fit, will slow down that method as it internally uses 5-fold cross-validation, and predict_proba may be inconsistent with predict. Read more in the User Guide.

    tol

    float, default=1e-3
    算法的优化标准

    Tolerance for stopping criterion.

    cache_size

    float, default=200
    以MB为单位指定内核缓存大小

    Specify the size of the kernel cache (in MB).

    属性

    class_weight_

    ndarray of shape (n_classes,)
    每个类参数c的乘数,基于属性class_weight计算

    Multipliers of parameter C for each class. Computed based on the class_weight parameter.

    classes_

    ndarray of shape (n_classes,)
    类标签

    The classes labels.

    coef_

    ndarray of shape (n_classes * (n_classes - 1) / 2, n_features)
    分配给每个特征的权重(当参数kernel='linear’时生效)

    Weights assigned to the features when kernel=“linear”.

    dual_coef_

    ndarray of shape (n_classes -1, n_SV)
    决策函数中支持向量的双系数

    Dual coefficients of the support vector in the decision function (see Mathematical formulation), multiplied by their targets. For multiclass, coefficient for all 1-vs-1 classifiers. The layout of the coefficients in the multiclass case is somewhat non-trivial. See the multi-class section of the User Guide for details.

    fit_status_

    int
    成功fit(拟合)将会返回0,否则返回1(触发警告)

    0 if correctly fitted, 1 otherwise (will raise warning)

    intercept_

    ndarray of shape (n_classes * (n_classes - 1) / 2,)
    决策函数中的常量

    Constants in decision function.

    n_features_in_

    int
    拟合过程中出现的特征数量

    Number of features seen during fit.

    feature_names_in_

    ndarray of shape (n_features_in_,)
    拟合过程中出现的特征名称(仅当参数X拥有字符串类型的特征名称时生效)

    Names of features seen during fit. Defined only when X has feature names that are all strings.

    n_iter_

    ndarray of shape (n_classes * (n_classes - 1) // 2,)
    为了拟合模型,优化算法运行的迭代次数。取决于优化模型的数量,后者又取决于类的数量

    Number of iterations run by the optimization routine to fit the model. The shape of this attribute depends on the number of models optimized which in turn depends on the number of classes.

    support_

    ndarray of shape (n_SV)
    支持向量的索引

    Indices of support vectors.

    support_vectors_

    ndarray of shape (n_SV, n_features)
    支持向量

    Support vectors.

    n_support_

    ndarray of shape (n_classes,), dtype=int32
    每个类的支持向量数量

    Number of support vectors for each class.

    probA_

    ndarray of shape (n_classes * (n_classes - 1) / 2)
    在platt scaling1(把模型的输出转化成一种基于类别的概率分布的方法)中学习到的参数

    Parameter learned in Platt scaling when probability=True.

    probB_

    ndarray of shape (n_classes * (n_classes - 1) / 2)
    在platt scaling(把模型的输出转化成一种基于类别的概率分布的方法)中学习到的参数

    Parameter learned in Platt scaling when probability=True.

    shape_fit_

    tuple of int of shape (n_dimensions_of_X,)
    用于训练的向量X的数组维度

    Array dimensions of training vector X.

    类方法

    decision_function(X)

    通过X中的样本数据评估决策函数

    Evaluate the decision function for the samples in X.

    fit(X, y[, sample_weight])

    根据给定的训练数据拟合SVM模型

    Fit the SVM model according to the given training data.

    get_params([deep])

    返回该模型的参数

    Get parameters for this estimator.

    predict(X)

    对X中的样本进行分类

    Perform classification on samples in X.

    predict_log_proba(X)

    计算X中样本的可能输出类型的概率的对数函数值

    Compute log probabilities of possible outcomes for samples in X.

    predict_proba(X)

    计算X中样本的可能输出类型的概率

    Compute probabilities of possible outcomes for samples in X.

    score(X, y[, sample_weight])

    根据给定的测试数据集和标签返回模型平均得分

    Return the mean accuracy on the given test data and labels.

    set_params(**params)

    设置模型参数

    Set the parameters of this estimator.


    1. 关于platt scaling可以参考博客:Platt scaling ↩︎

  • 相关阅读:
    线性代数学习笔记8-4:正定矩阵、二次型的几何意义、配方法与消元法的联系、最小二乘法与半正定矩阵A^T A
    java毕业设计房屋租赁(附源码、数据库)
    ORACLE数据库查询所有索引的sql语句
    已经建好了项目,上传到gitee
    开源博客项目Blog .NET Core源码学习(5:mapster使用浅析)
    学习pytorch7 神经网络的基本骨架--nn,module的使用
    基于ssm的图书馆管理系统设计与实现-计算机毕业设计源码
    和对手‘打’成一片
    java 带括号 四则运算 计算器
    设计模式——装饰器模式
  • 原文地址:https://blog.csdn.net/m0_54510474/article/details/125889485