September 2019
Intermediate to advanced
420 pages
10h 29m
English
Before you get started with setting up a model, it is always a good idea to have a look at the data. We did this earlier for the town map example, so let's repeat it here too. Using Matplotlib, we create a scatter plot where the color of each data point corresponds to the class label:
In [10]: plt.scatter(data[:, 0], data[:, 1], c=target, cmap=plt.cm.Paired, s=100)... plt.xlabel(iris.feature_names[0])... plt.ylabel(iris.feature_names[1])Out[10]: <matplotlib.text.Text at 0x23bb5e03eb8>
To make plotting easier, we limit ourselves to the first two features (iris.feature_names[0] being the sepal length and iris.feature_names[1] being the sepal width). We can see a nice separation of classes in the following diagram:
The ...
Read now
Unlock full access