W3cubDocs

/scikit-learn

sklearn.datasets.load_iris

sklearn.datasets.load_iris(return_X_y=False) [source]

Load and return the iris dataset (classification).

The iris dataset is a classic and very easy multi-class classification dataset.

Classes 3
Samples per class 50
Samples total 150
Dimensionality 4
Features real, positive

Read more in the User Guide.

Parameters:
return_X_y : boolean, default=False.

If True, returns (data, target) instead of a Bunch object. See below for more information about the data and target object.

New in version 0.18.

Returns:
data : Bunch

Dictionary-like object, the interesting attributes are: ‘data’, the data to learn, ‘target’, the classification labels, ‘target_names’, the meaning of the labels, ‘feature_names’, the meaning of the features, ‘DESCR’, the full description of the dataset, ‘filename’, the physical location of iris csv dataset (added in version 0.20).

(data, target) : tuple if return_X_y is True

New in version 0.18.

Notes

Changed in version 0.20: Fixed two wrong data points according to Fisher’s paper. The new version is the same as in R, but not as in the UCI Machine Learning Repository.

Examples

Let’s say you are interested in the samples 10, 25, and 50, and want to know their class name.

>>> from sklearn.datasets import load_iris
>>> data = load_iris()
>>> data.target[[10, 25, 50]]
array([0, 0, 1])
>>> list(data.target_names)
['setosa', 'versicolor', 'virginica']

Examples using sklearn.datasets.load_iris

© 2007–2018 The scikit-learn developers
Licensed under the 3-clause BSD License.
http://scikit-learn.org/stable/modules/generated/sklearn.datasets.load_iris.html