sklearn 常用api(二)

sklearn 常用api(一)

  • classifier/estimator(而不同于 transformer

    • from sklearn.linear_model import LogisticRegression
    • from sklearn.tree import DecisionTreeClassifier
    • from sklearn.neighbors import KNeighborsClassifier

sklearn.base

>>> import sklearn
>>> dir(sklearn.base)


sklearn 常用api(二)_第1张图片

sklearn.cross_validation

cv: cross_validation,交叉验证

from sklearn.cross_validation import StratifiedKFold
from sklearn.cross_validation import KFold

StratifiedKFold 是改进升级版的 KFold 方法,两者实现上的区别,根据二者的接口便知,

class sklearn.cross_validation.KFold(n, n_folds=3, shuffle=False, random_state=None) # 一般取 n == len(y) # 也即根据长度进行split # 不考虑class distribution class sklearn.cross_validation.StratifiedKFold(y, n_folds=3, shuffle=False, random_state=None) 

DecisionTreeClassifier

from sklearn.tree import DecisionTreeClassifier

Decision Tree classifier 是不需要对 features 进行标准化(StandardScaler)的。

你可能感兴趣的:(sklearn 常用api(二))