8.1. 玩具数据集#

scikit-learn 附带了一些小型标准数据集,无需从外部网站下载任何文件。

可以使用以下函数加载它们

load_iris(*[, return_X_y, as_frame])

加载并返回鸢尾花数据集(分类)。

load_diabetes(*[, return_X_y, as_frame, scaled])

加载并返回糖尿病数据集(回归)。

load_digits(*[, n_class, return_X_y, as_frame])

加载并返回数字数据集(分类)。

load_linnerud(*[, return_X_y, as_frame])

加载并返回体育锻炼 Linnerud 数据集。

load_wine(*[, return_X_y, as_frame])

加载并返回葡萄酒数据集(分类)。

load_breast_cancer(*[, return_X_y, as_frame])

加载并返回乳腺癌威斯康星数据集(分类)。

这些数据集对于快速演示 scikit-learn 中实现的各种算法的行为很有用。然而,它们通常太小,不足以代表真实的机器学习任务。

8.1.1. 鸢尾花数据集#

数据集特征

实例数量:

150(三类中每类 50 个)

属性数量:

4 个数字预测属性和类别

属性信息:
  • sepal length in cm(花萼长度(厘米))

  • sepal width in cm(花萼宽度(厘米))

  • petal length in cm(花瓣长度(厘米))

  • petal width in cm(花瓣宽度(厘米))

  • 类别
    • Iris-Setosa(山鸢尾)

    • Iris-Versicolour(杂色鸢尾)

    • Iris-Virginica(维吉尼亚鸢尾)

摘要统计:

sepal length(花萼长度)

4.3

7.9

5.84

0.83

0.7826

sepal width(花萼宽度)

2.0

4.4

3.05

0.43

-0.4194

petal length(花瓣长度)

1.0

6.9

3.76

1.76

0.9490 (高!)

petal width(花瓣宽度)

0.1

2.5

1.20

0.76

0.9565 (高!)

缺失属性值:

None

类别分布:

3 个类别中每类各占 33.3%。

创建者:

R.A. Fisher

捐赠者:

Michael Marshall (MARSHALL%PLU@io.arc.nasa.gov)

日期:

July, 1988

著名的鸢尾花数据库,最早由 R.A. Fisher 爵士使用。该数据集取自 Fisher 的论文。请注意,它与 R 中的相同,但与 UCI 机器学习库中的不同,后者有两个错误数据点。

这可能是模式识别文献中发现的最著名的数据库。Fisher 的论文是该领域的经典之作,至今仍被频繁引用。(例如,参见 Duda & Hart)。该数据集包含 3 个类别,每个类别有 50 个实例,每个类别代表一种鸢尾花。一个类别与其他两个类别线性可分;后两个类别彼此不线性可分。

参考文献#
  • Fisher, R.A. “The use of multiple measurements in taxonomic problems” Annual Eugenics, 7, Part II, 179-188 (1936); also in “Contributions to Mathematical Statistics” (John Wiley, NY, 1950).

  • Duda, R.O., & Hart, P.E. (1973) Pattern Classification and Scene Analysis. (Q327.D83) John Wiley & Sons. ISBN 0-471-22361-1. See page 218.

  • Dasarathy, B.V. (1980) “Nosing Around the Neighborhood: A New System Structure and Classification Rule for Recognition in Partially Exposed Environments”. IEEE Transactions on Pattern Analysis and Machine Intelligence, Vol. PAMI-2, No. 1, 67-71.

  • Gates, G.W. (1972) “The Reduced Nearest Neighbor Rule”. IEEE Transactions on Information Theory, May 1972, 431-433.

  • See also: 1988 MLC Proceedings, 54-64. Cheeseman et al”s AUTOCLASS II conceptual clustering system finds 3 classes in the data.

  • Many, many more …(还有很多……)

8.1.2. 糖尿病数据集#

对 n = 442 名糖尿病患者获取了十个基线变量,包括年龄、性别、体重指数、平均血压以及六项血清测量值,以及感兴趣的响应变量,即基线后一年疾病进展的定量测量值。

数据集特征

实例数量:

442

属性数量:

前 10 列是数字预测值

目标:

第 11 列是基线后一年疾病进展的定量测量值

属性信息:
  • age 年龄(岁)

  • 性别

  • bmi 体重指数

  • bp 平均血压

  • s1 tc,总血清胆固醇

  • s2 ldl,低密度脂蛋白

  • s3 hdl,高密度脂蛋白

  • s4 tch,总胆固醇 / HDL

  • s5 ltg,可能是血清甘油三酯水平的对数

  • s6 glu,血糖水平

注意:这 10 个特征变量均经过了均值中心化处理,并按标准差乘以 n_samples 平方根的因子进行缩放(即每列的平方和总计为 1)。

来源网址: https://www4.stat.ncsu.edu/~boos/var.select/diabetes.html

更多信息请参见:Bradley Efron, Trevor Hastie, Iain Johnstone and Robert Tibshirani (2004) “Least Angle Regression,” Annals of Statistics (with discussion), 407-499. (https://web.stanford.edu/~hastie/Papers/LARS/LeastAngle_2002.pdf)

8.1.3. 手写数字光学识别数据集#

数据集特征

实例数量:

1797

属性数量:

64

属性信息:

8x8 图像,整数像素值范围为 0..16。

缺失属性值:

None

创建者:
  1. Alpaydin (alpaydin ‘@’ boun.edu.tr)

日期:

July; 1998

这是 UCI ML 手写数字数据集测试集的副本 https://archive.ics.uci.edu/ml/datasets/Optical+Recognition+of+Handwritten+Digits

该数据集包含手写数字图像:10 个类别,每个类别代表一个数字。

使用了 NIST 提供的预处理程序,从预印表格中提取手写数字的标准化位图。总共 43 人中,30 人贡献给训练集,另外 13 人贡献给测试集。32x32 位图被划分为非重叠的 4x4 块,并计算每个块中“开”像素的数量。这生成了一个 8x8 的输入矩阵,其中每个元素都是一个范围在 0..16 的整数。这降低了维度并提供了对微小失真的不变性。

有关 NIST 预处理例程的信息,请参阅 M. D. Garris, J. L. Blue, G. T. Candela, D. L. Dimmick, J. Geist, P. J. Grother, S. A. Janet, and C. L. Wilson, NIST Form-Based Handprint Recognition System, NISTIR 5469, 1994.

参考文献#
  • C. Kaynak (1995) Methods of Combining Multiple Classifiers and Their Applications to Handwritten Digit Recognition, MSc Thesis, Institute of Graduate Studies in Science and Engineering, Bogazici University.

    1. Alpaydin, C. Kaynak (1998) Cascading Classifiers, Kybernetika.

  • Ken Tang and Ponnuthurai N. Suganthan and Xi Yao and A. Kai Qin. Linear dimensionalityreduction using relevance weighted LDA. School of Electrical and Electronic Engineering Nanyang Technological University. 2005.

  • Claudio Gentile. A New Approximate Maximal Margin Classification Algorithm. NIPS. 2000.

8.1.4. Linnerrud 数据集#

数据集特征

实例数量:

20

属性数量:

3

缺失属性值:

None

Linnerud 数据集是一个多输出回归数据集。它包含从健身俱乐部的二十名中年男性收集的三个运动(数据)变量和三个生理(目标)变量。

  • 生理变量 - CSV 文件包含 20 个观测值的 3 个生理变量

    体重、腰围和脉搏。

  • 运动变量 - CSV 文件包含 20 个观测值的 3 个运动变量

    引体向上、仰卧起坐和跳跃。

参考文献#
  • Tenenhaus, M. (1998). La regression PLS: theorie et pratique. Paris: Editions Technic.

8.1.5. 葡萄酒识别数据集#

数据集特征

实例数量:

178

属性数量:

13 个数字预测属性和类别

属性信息:
  • 酒精

  • 苹果酸

  • 灰分

  • 灰分的碱度

  • 总酚

  • 类黄酮

  • 非类黄酮酚

  • 原花青素

  • 颜色强度

  • 色调

  • 稀释葡萄酒的 OD280/OD315

  • 脯氨酸

  • 类别
    • class_0

    • class_1

    • class_2

摘要统计:

酒精

11.0

14.8

13.0

0.8

苹果酸

0.74

5.80

2.34

1.12

灰分

1.36

3.23

2.36

0.27

灰分碱度

10.6

30.0

19.5

3.3

70.0

162.0

99.7

14.3

总酚

0.98

3.88

2.29

0.63

类黄酮

0.34

5.08

2.03

1.00

非类黄酮酚

0.13

0.66

0.36

0.12

原花青素

0.41

3.58

1.59

0.57

颜色强度

1.3

13.0

5.1

2.3

色调

0.48

1.71

0.96

0.23

稀释葡萄酒的 OD280/OD315

1.27

4.00

2.61

0.71

脯氨酸

278

1680

746

315

缺失属性值:

None

类别分布:

class_0 (59), class_1 (71), class_2 (48)

创建者:

R.A. Fisher

捐赠者:

Michael Marshall (MARSHALL%PLU@io.arc.nasa.gov)

日期:

July, 1988

这是 UCI ML 葡萄酒识别数据集的副本。 https://archive.ics.uci.edu/ml/machine-learning-databases/wine/wine.data

数据是化学分析的结果,分析了同一地区由三位不同种植者种植的葡萄酒。对三种葡萄酒中发现的不同成分进行了十三种不同的测量。

原始所有者

Forina, M. et al, PARVUS - An Extendible Package for Data Exploration, Classification and Correlation. Institute of Pharmaceutical and Food Analysis and Technologies, Via Brigata Salerno, 16147 Genoa, Italy.

引用

Lichman, M. (2013). UCI Machine Learning Repository [https://archive.ics.uci.edu/ml]. Irvine, CA: University of California, School of Information and Computer Science.

参考文献#

(1) S. Aeberhard, D. Coomans and O. de Vel, Comparison of Classifiers in High Dimensional Settings, Tech. Rep. no. 92-02, (1992), Dept. of Computer Science and Dept. of Mathematics and Statistics, James Cook University of North Queensland. (Also submitted to Technometrics).

该数据与其他许多数据一起用于比较各种分类器。这些类别是可分离的,尽管只有 RDA 实现了 100% 的正确分类。(RDA:100%,QDA 99.4%,LDA 98.9%,1NN 96.1%(z 转换数据))(所有结果均使用留一法技术)

(2) S. Aeberhard, D. Coomans and O. de Vel, “THE CLASSIFICATION PERFORMANCE OF RDA” Tech. Rep. no. 92-01, (1992), Dept. of Computer Science and Dept. of Mathematics and Statistics, James Cook University of North Queensland. (Also submitted to Journal of Chemometrics).

8.1.6. 威斯康星州乳腺癌(诊断)数据集#

数据集特征

实例数量:

569

属性数量:

30 个数字预测属性和类别

属性信息:
  • radius (mean of distances from center to points on the perimeter)(半径(从中心到周长上点的平均距离))

  • texture (standard deviation of gray-scale values)(纹理(灰度值的标准差))

  • perimeter(周长)

  • area(面积)

  • smoothness (local variation in radius lengths)(平滑度(半径长度的局部变化))

  • compactness (perimeter^2 / area - 1.0)(紧凑度(周长^2 / 面积 - 1.0))

  • concavity (severity of concave portions of the contour)(凹度(轮廓凹陷部分的严重程度))

  • concave points (number of concave portions of the contour)(凹点(轮廓凹陷部分的数量))

  • symmetry(对称性)

  • fractal dimension (“coastline approximation” - 1)(分形维数(“海岸线近似” - 1))

对每张图像计算这些特征的平均值、标准误差和“最差”或最大值(三个最差/最大值的平均值),共得到 30 个特征。例如,字段 0 是平均半径,字段 10 是半径标准误差,字段 20 是最差半径。

  • 类别
    • WDBC-Malignant(WDBC-恶性)

    • WDBC-Benign(WDBC-良性)

摘要统计:

radius (mean)(半径(平均值))

6.981

28.11

texture (mean)(纹理(平均值))

9.71

39.28

perimeter (mean)(周长(平均值))

43.79

188.5

area (mean)(面积(平均值))

143.5

2501.0

smoothness (mean)(平滑度(平均值))

0.053

0.163

compactness (mean)(紧凑度(平均值))

0.019

0.345

concavity (mean)(凹度(平均值))

0.0

0.427

concave points (mean)(凹点(平均值))

0.0

0.201

symmetry (mean)(对称性(平均值))

0.106

0.304

fractal dimension (mean)(分形维数(平均值))

0.05

0.097

radius (standard error)(半径(标准误差))

0.112

2.873

texture (standard error)(纹理(标准误差))

0.36

4.885

perimeter (standard error)(周长(标准误差))

0.757

21.98

area (standard error)(面积(标准误差))

6.802

542.2

smoothness (standard error)(平滑度(标准误差))

0.002

0.031

compactness (standard error)(紧凑度(标准误差))

0.002

0.135

concavity (standard error)(凹度(标准误差))

0.0

0.396

concave points (standard error)(凹点(标准误差))

0.0

0.053

symmetry (standard error)(对称性(标准误差))

0.008

0.079

fractal dimension (standard error)(分形维数(标准误差))

0.001

0.03

radius (worst)(半径(最差值))

7.93

36.04

texture (worst)(纹理(最差值))

12.02

49.54

perimeter (worst)(周长(最差值))

50.41

251.2

area (worst)(面积(最差值))

185.2

4254.0

smoothness (worst)(平滑度(最差值))

0.071

0.223

compactness (worst)(紧凑度(最差值))

0.027

1.058

concavity (worst)(凹度(最差值))

0.0

1.252

concave points (worst)(凹点(最差值))

0.0

0.291

symmetry (worst)(对称性(最差值))

0.156

0.664

fractal dimension (worst)(分形维数(最差值))

0.055

0.208

缺失属性值:

None

类别分布:

212 - 恶性, 357 - 良性

创建者:

Dr. William H. Wolberg, W. Nick Street, Olvi L. Mangasarian

捐赠者:

Nick Street

日期:

November, 1995

这是 UCI ML 威斯康星州乳腺癌(诊断)数据集的副本。 https://goo.gl/U2Uwz2

特征是通过对乳房肿块细针穿刺 (FNA) 数字化图像进行计算得出的。它们描述了图像中存在的细胞核特征。

上述分离平面是使用多曲面方法树 (MSM-T) [K. P. Bennett, “Decision Tree Construction Via Linear Programming.” Proceedings of the 4th Midwest Artificial Intelligence and Cognitive Science Society, pp. 97-101, 1992] 获得的,该分类方法使用线性规划来构建决策树。相关特征是通过在 1-4 个特征和 1-3 个分离平面的空间中进行穷举搜索来选择的。

用于获取 3 维空间中分离平面的实际线性规划描述于:[K. P. Bennett and O. L. Mangasarian: “Robust Linear Programming Discrimination of Two Linearly Inseparable Sets”, Optimization Methods and Software 1, 1992, 23-34].

该数据库也可通过 UW CS ftp 服务器获得

ftp ftp.cs.wisc.edu cd math-prog/cpo-dataset/machine-learn/WDBC/

参考文献#
  • W.N. Street, W.H. Wolberg and O.L. Mangasarian. Nuclear feature extraction for breast tumor diagnosis. IS&T/SPIE 1993 International Symposium on Electronic Imaging: Science and Technology, volume 1905, pages 861-870, San Jose, CA, 1993.

  • O.L. Mangasarian, W.N. Street and W.H. Wolberg. Breast cancer diagnosis and prognosis via linear programming. Operations Research, 43(4), pages 570-577, July-August 1995.

  • W.H. Wolberg, W.N. Street, and O.L. Mangasarian. Machine learning techniques to diagnose breast cancer from fine-needle aspirates. Cancer Letters 77 (1994) 163-171.