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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.