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 =[:, :2]  #load the first two features of the iris data y_w =       #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 O’Reilly online learning.

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