September 2019
Intermediate to advanced
420 pages
10h 29m
English
We can plot these data points in a scatter plot using Matplotlib. Here, the idea is to plot the x values (found in the first column of X, X[:, 0]) against the y values (found in the second column of X, X[:, 1]). A neat trick is to pass the target labels as color values (c=y):
In [3]: import matplotlib.pyplot as plt... %matplotlib inline... plt.scatter(X[:, 0], X[:, 1], c=y, s=100)... plt.xlabel('x values')... plt.ylabel('y values')Out[3]: <matplotlib.text.Text at 0x24f7ffb00f0>
This will produce the following output:

The preceding output shows the randomly generated data for a binary classification problem. You can ...
Read now
Unlock full access