鸢尾花(iris)数据集介绍( 鸢【音:yuān】)
flyfish
这份数据集年代久远,R.A Fisher在1936年发表的文章中被使用
iris ['aɪrɪs]
鸢尾花(iris)数据集,它共有4个属性列和一个品种类别列
sepal length(萼片长度)、
sepal width(萼片宽度)、
petal length(花瓣长度)、
petal width (花瓣宽度),
单位是厘米。
3个品种类别是Setosa、Versicolour、Virginica,样本数量150个,每类50个。
Attribute Information:
1. sepal length in cm
2. sepal width in cm
3. petal length in cm
4. petal width in cm
5. class:
-- Iris Setosa
-- Iris Versicolour
-- Iris Virginic
可视化显示 只绘制点,不绘制线
from sklearn.datasets import load_iris
import matplotlib.pyplot as plt
iris = load_iris()
X = iris['data']
y = iris['target']
names = iris['target_names']
feature_names = iris['feature_names']
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(16,8))
for target, target_name in enumerate(names):
X_plot = X[y == target]
ax1.plot(X_plot[:, 0], X_plot[:, 1], linestyle='none', marker='o', label=target_name)
ax1.set_xlabel(feature_names[0])
ax1.set_ylabel(feature_names[1])
ax1.legend();
for target, target_name in enumerate(names):
X_plot = X[y == target]
ax2.plot(X_plot[:, 2], X_plot[:, 3], linestyle='none', marker='o', label=target_name)
ax2.set_xlabel(feature_names[2])
ax2.set_ylabel(feature_names[3])
ax2.legend();
http://archive.ics.uci.edu/ml/datasets/Iris