sklearn各模块详解(1)

文章目录

  • 四、.svm
    • 4.1 分类
    • 4.2 回归
  • 五、.neighbors

四、.svm

from sklearn import svm

4.1 分类

  1. svm.SVC(C=1.0, kernel=’rbf’, degree=3, gamma=’auto_deprecated’, 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’, random_state=None)

C
kernel:指定核函数:linear,polynomial,rbf,sigmoid。还可以是自定义的核函数。
degree:当kernel指定为polynomial时,指定多项式次数。
gamma:当kernel为非linear时,指定 γ \gamma γ的值。
coef0:当kernelpolynomialsigmoid时,指定r的值。
shrinking
probability
tol
cache_size
class_weight:在fit方法中设置,用于样本不平衡问题。
verbose
max_iter
decision_function_shapeovo表示一对一,ovr表示一对剩下的,
random_state:略


  1. svm.NuSVC(nu=0.5, kernel=’rbf’, degree=3, gamma=’auto_deprecated’, 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’, random_state=None)

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

4.2 回归

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

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

  1. 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)

属性:
support_vectors_
support_
n_support
.decision_function
dual_coef_ y i α i y_i \alpha_i yiαi α i − α i ∗ \alpha_i - \alpha_i^* αiαi
intercept_:略



五、.neighbors

  1. .NearestNeighbors(n_neighbors=5, radius=1.0, algorithm=’auto’, leaf_size=30, metric=’minkowski’, p=2, metric_params=None, n_jobs=None, **kwargs)

n_neighbors:近邻数,即选择最近的几个样本来分类。
radius
algorithm:算法:‘auto’, ‘ball_tree’, ‘kd_tree’, ‘brute`


  1. .KDTree

  1. .BallTree

方法:



你可能感兴趣的:(机器学习和数据挖掘)