常用数据集
| 数据集名称 |
调用方式 |
适用算法 |
数据规模 |
| 波士顿房价数据集 |
load_boston() |
回归 |
506*13 |
| 鸢尾花数据集 |
load_iris() |
分类 |
150*4 |
| 糖尿病数据集 |
load_diabetes() |
回归 |
442*10 |
| 手写数字数据集 |
load_digits() |
分类 |
5620*64 |
| Olivetti 脸部图像数据集 |
fetch_olivetti_faces() |
降维 |
4006464 |
| 新闻分类数据集 |
fetch_20newsgroups() |
分类 |
- |
| 带标签的人脸数据集 |
fetch_lfw_people() |
分类;降维 |
- |
| 路透社新闻语料数据集 |
fetch_rcv1() |
分类 |
804414*47236 |
sklearn.datasets.load_boston
其重要参数为:
•return_X_y:表示是否返回target(即价格),默认为False,只返回data(即属性)。
1 2 3 4
| >>> from sklearn.datasets import load_boston >>> boston = load_boston >>> print( boston.data.shape) (506, 13)
|
sklearn库的基本功能
分类任务
| 分类模型 |
加载模块 |
| 最近邻算法 |
neighbors.NearestNeighbors |
| 支持向量机 |
svm.SVC |
| 朴素贝叶斯 |
naive_bayes.GaussianNB |
| 决策树 |
tree.DecisionTreeClassifier |
| 集成方法 |
ensemble.BaggingClassifier |
| 神经网络 |
neural_network.MLPClassifier |
回归任务
| 回归模型 |
加载模块 |
| 岭回归 |
linear_model.Ridge |
| Lasso回归 |
linear_model.Lasso |
| 弹性网络 |
linear_model.ElasticNet |
| 最小角回归 |
linear_model.Lars |
| 贝叶斯回归 |
linear_model.BayesianRidge |
| 逻辑回归 |
linear_model.LogisticRegression |
| 多项式回归 |
preprocessing. PolynomialFeatures |
聚类任务
| 聚类方法 |
加载模块 |
| K-means |
cluster.KMeans |
| AP聚类 |
cluster.AffinityPropagation |
| 均值漂移 |
cluster.MeanShift |
| 层次聚类 |
cluster.AgglomerativeClustering |
| DBSCAN |
cluster.DBSCAN |
| BIRCH |
cluster.Birch |
| 谱聚类 |
cluster.SpectralClustering |
降维人物
| 降维方法 |
加载模块 |
| 主成分分析 |
decomposition.PCA |
| 截断SVD和LSA |
decomposition.TruncatedSVD |
| 字典学习 |
decomposition.SparseCoder |
| 因子分析 |
decomposition.FactorAnalysis |
| 独立成分分析 |
decomposition.FastICA |
| 非负矩阵分解 |
decomposition.NMF |
| LDA |
decomposition.LatentDirichletAllocation |