Getting ready

Load two classes and two features of the iris dataset:

#load the libraries we have been usingimport numpy as npimport pandas as pdimport matplotlib.pyplot as pltfrom sklearn import datasetsiris = datasets.load_iris()X_w = iris.data[:, :2]  #load the first two features of the iris data y_w = iris.target       #load the target of the iris dataX = X_w[y_w != 0]y = y_w[y_w != 0]X_1 = X[y == 1]X_2 = X[y == 2]

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.