Question: how to do svm in python?
Answer: class SVM:def fit(self, X, y): n_samples, n_features = X.shape# P = X^T X. ... 
X, y = make_blobs(n_samples=250, centers=2, random_state=0, cluster_std=0.60)y[y == 0] = -1tmp = np.ones(len(X))y = tmp * y.
def f(x, w, b, c=0): ... 
plt.scatter(X_train[:, 0], X_train[:, 1], c=y_train, cmap='winter');