Simplestory's Blog

Scikit-learn调包合集

Word count: 189Reading time: 1 min
2018/08/26

这次整理一下常用的scikit-learn包,作为备忘

K近邻算法:

from sklearn.neighbors import KNeighborsClassifier

线性回归:

from sklearn.linear_model import LinearRegression

逻辑回归:

from sklearn.linear_model import LogisticRgression

决策树:

from sklearn.tree import DecisionTreeClassifier

朴素贝叶斯:

  1. 高斯分布:from sklearn.neive_bayes import GaussianNB
  2. 多项式分布:from sklearn.neive_baybes import MultinomnalNB
  3. 伯努利分布:from sklearn.neive_baybes import BernoulliNB

支持向量机:

  1. 分类:from sklearn.svm import SVC
  2. 回归:from sklearn.svm import SVR

集合算法(sklearn.ensemble):

  • bagging:

分类:from sklearn.ensemble import BaggingClassifier

回归:from sklearn.ensemble import BaggingRegression

  • AdaBoost:

分类:from sklearn.ensemble import AdaBoostClassifier

回归:from sklearn.ensemble import AdaBoostRegression

  • 随机森林:

分类:from sklearn.ensemble import RandomForestClassifier

回归:from sklearn.ensemble import RandomForestRegression

K均值:

from sklearn.cluster import KMeans

PCA降维:

from sklearn.decomposition import PCA

最后附上一张scikit寻宝图:

scikit-learn cheat sheet

CATALOG