Getting ready

Start by loading the iris dataset once again and dividing the data into training and testing sets:

from sklearn.datasets import load_irisiris = load_iris()X = iris.datay = iris.targetfrom sklearn.model_selection import train_test_splitX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, stratify=y)

Get scikit-learn Cookbook - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.