logo

SVM 使用

wangzf / 2023-04-05


目录

SVM API

分类

SVC

class sklearn.svm.SVC(
    *, 
    C = 1.0, 
    kernel = 'rbf',  # linear, poly, rbf(默认), sigmoid, precomputed
    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
)

核心参数:

LinearSVC

class sklearn.svm.LinearSVC(
    *,
    C = 1.0,
    loss = 'squared_hinge',
    penalty = 'l2',
    multi_class = 'ovr', 
    dual = True,
    tol = 0.0001,
    fit_intercept = True, 
    intercept_scaling = 1, 
    class_weight = None, 
    verbose = 0, 
    random_state = None, 
    max_iter = 1000
)

核心参数:

SGDClassifier

class sklearn.linear_model.SGDClassifier(
    loss = 'hinge',
    *,
    penalty = 'l2',
    alpha = 0.0001,
    l1_ratio = 0.15,
    fit_intercept = True,
    max_iter = 1000,
    tol = 0.001,
    shuffle = True,
    verbose = 0,
    epsilon = 0.1,
    n_jobs = None, 
    random_state = None, 
    learning_rate = 'optimal', 
    eta0 = 0.0, 
    power_t = 0.5, 
    early_stopping = False, 
    validation_fraction = 0.1, 
    n_iter_no_change = 5, 
    class_weight = None, 
    warm_start = False, 
    average = False
)

核心参数:

回归

SVR

Epsilon-Support Vector Regression

class sklearn.svm.SVR(
    *, 
    C = 1.0, 
    kernel = 'rbf', 
    degree = 3, 
    gamma = 'scale', 
    coef0 = 0.0, 
    tol = 0.001, 
    epsilon = 0.1, 
    shrinking = True, 
    cache_size = 200, 
    verbose = False, 
    max_iter = -1
)

核心参数:

SGDRegressor

class sklearn.linear_model.SGDRegressor(
    loss = 'squared_error', 
    *, 
    penalty = 'l2', 
    alpha = 0.0001, 
    l1_ratio = 0.15, 
    fit_intercept = True, 
    max_iter = 1000, 
    tol = 0.001, 
    shuffle = True, 
    verbose = 0, 
    epsilon = 0.1, 
    random_state = None, 
    learning_rate = 'invscaling', 
    eta0 = 0.01, 
    power_t = 0.25, 
    early_stopping = False, 
    validation_fraction = 0.1, 
    n_iter_no_change = 5, 
    warm_start = False, 
    average = False
)

核心参数:

LinearSVR

class sklearn.svm.LinearSVR(
    *, 
    epsilon = 0.0, 
    tol = 0.0001, 
    C = 1.0, 
    loss = 'epsilon_insensitive', 
    fit_intercept = True, 
    intercept_scaling = 1.0, 
    dual = True, 
    verbose = 0, 
    random_state = None, 
    max_iter = 1000
)

核心参数:

NuSVR

Nu Support Vector Regression

class sklearn.svm.NuSVR(
    *, 
    nu = 0.5, 
    C = 1.0, 
    kernel = 'rbf', 
    degree = 3, 
    gamma = 'scale', 
    coef0 = 0.0, 
    shrinking = True, 
    tol = 0.001, 
    cache_size = 200, 
    verbose = False, 
    max_iter = -1
)

核心参数:

核函数

方法

参考