wine_data:用于分类的三类别葡萄酒数据集
一个将 Wine 数据集加载到 NumPy 数组的函数。
from mlxtend.data import wine_data
概述
用于分类的葡萄酒数据集。
| 样本 | 178 |
| 特征 | 13 |
| 类别 | 3 |
| 数据集特点 | 多元 |
| 属性特点 | 整数,实数 |
| 相关任务 | 分类 |
| 缺失值 | 无 |
| 列 | 属性 |
|---|---|
| 1) | 类别标签 |
| 2) | 酒精 |
| 3) | 苹果酸 |
| 4) | 灰 |
| 5) | 灰分碱度 |
| 6) | 镁 |
| 7) | 总酚 |
| 8) | 类黄酮 |
| 9) | 非类黄酮酚 |
| 10) | 原花青素 |
| 11) | 颜色强度 |
| 12) | 色调 |
| 13) | 稀释葡萄酒的 OD280/OD315 |
| 14) | 脯氨酸 |
| 类别 | 样本 |
|---|---|
| 0 | 59 |
| 1 | 71 |
| 2 | 48 |
参考文献
- 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.
- 来源:https://archive.ics.uci.edu/ml/datasets/Wine
- Bache, K. & Lichman, M. (2013). UCI Machine Learning Repository. Irvine, CA: University of California, School of Information and Computer Science.
示例 1 - 数据集概述
from mlxtend.data import wine_data
X, y = wine_data()
print('Dimensions: %s x %s' % (X.shape[0], X.shape[1]))
print('\nHeader: %s' % ['alcohol', 'malic acid', 'ash', 'ash alcalinity',
'magnesium', 'total phenols', 'flavanoids',
'nonflavanoid phenols', 'proanthocyanins',
'color intensity', 'hue', 'OD280/OD315 of diluted wines',
'proline'])
print('1st row', X[0])
Dimensions: 178 x 13
Header: ['alcohol', 'malic acid', 'ash', 'ash alcalinity', 'magnesium', 'total phenols', 'flavanoids', 'nonflavanoid phenols', 'proanthocyanins', 'color intensity', 'hue', 'OD280/OD315 of diluted wines', 'proline']
1st row [ 1.42300000e+01 1.71000000e+00 2.43000000e+00 1.56000000e+01
1.27000000e+02 2.80000000e+00 3.06000000e+00 2.80000000e-01
2.29000000e+00 5.64000000e+00 1.04000000e+00 3.92000000e+00
1.06500000e+03]
import numpy as np
print('Classes: %s' % np.unique(y))
print('Class distribution: %s' % np.bincount(y))
Classes: [0 1 2]
Class distribution: [59 71 48]
API
wine_data()
葡萄酒数据集。
-
来源:https://archive.ics.uci.edu/ml/datasets/Wine -
样本数量: 178 -
类别标签:{0, 1, 2},分布:[59, 71, 48]数据集属性
- 1) 酒精
- 2) 苹果酸
- 3) 灰
- 4) 灰分碱度
- 5) 镁
- 6) 总酚
- 7) 类黄酮
- 8) 非类黄酮酚
- 9) 原花青素
- 10) 颜色强度
- 11) 色调
- 12) 稀释葡萄酒的 OD280/OD315
- 13) 脯氨酸
返回值
-
X, y:[样本数, 特征数], [类别标签数]X 是特征矩阵,包含 178 个葡萄酒样本(行)和 13 个特征(列)。y 是一个包含 3 个类别标签 0、1、2 的一维数组。
示例
有关用法示例,请参阅 https://mlxtend.cn/mlxtend/user_guide/data/wine_data