Iris#

Measurements of 150 iris flowers from three species, 50 flowers each. It is one of the earliest datasets used to evaluate classification methods and a common first test for a new classifier. One class is linearly separable from the other two, which are not linearly separable from each other.

Overview#

Loader

load_iris()

Task

Classification

Samples

150

Features

4

Targets

3 classes: setosa (0), versicolor (1), virginica (2)

Missing values

None

License

CC BY 4.0

Features#

sepal length (cm), sepal width (cm), petal length (cm) and petal width (cm).

Target#

y holds the species of each flower as an integer label. The classes are perfectly balanced, with 50 samples each.

Source and citation#

Please cite the dataset as:

Fisher, R. (1936). Iris [Dataset]. UCI Machine Learning Repository. https://doi.org/10.24432/C56C76

See also:

  • Fisher, R. A. (1936). The use of multiple measurements in taxonomic problems. Annals of Eugenics, 7(2), 179-188.

License#

CC BY 4.0, as stated by the source. The license was checked at the source on 2026-10-17. See License and citation.

Changes made#

  • Converted to the NumPy NPZ format. Values are stored as float64 and the species as int64 labels (0 = setosa, 1 = versicolor, 2 = virginica).

  • Samples 35 and 38 follow Fisher’s paper, as corrected in scikit-learn. The UCI page lists these two samples as differing between its file and the paper.

  • Feature and class names follow scikit-learn.

Example#

>>> import numpy as np
>>> from pyml_datasets import load_iris
>>> data = load_iris()
>>> data.X.shape, data.y.shape
((150, 4), (150,))
>>> data.target_names
('setosa', 'versicolor', 'virginica')
>>> np.bincount(data.y)
array([50, 50, 50])