We do not expect you in this class to learn every detail of the models.
We use make_blobs
because it gives us control over the data and it's separation; we don't have to clean or standardize it.
##imports
import numpy as np
import matplotlib.pyplot as plt
from sklearn import svm
from sklearn.datasets import make_blobs
X, y = make_blobs(n_samples = 100, n_features=2, centers=2, random_state=3)
## Plot Blobs
plt.scatter(X[:,0], X[:,1], c=y, cmap="viridis")
plt.xlabel(r'$x_0$'); plt.ylabel(r'$x_1$')
Text(0, 0.5, '$x_1$')
We are just guessing. SVM does this automatically.
## Make guess for separation line
plt.scatter(X[:,0], X[:,1], c=y, cmap="viridis")
xx = np.linspace(-6.5, 2.5)
#yy = -1*xx
#yy = -2 * xx - 1
yy = -0.5 * xx + 1
plt.plot(xx,yy)
[<matplotlib.lines.Line2D at 0x7ff7f1409750>]