Module 9 · Intermediate · Support vector machines (SVM)

SVM from scratch in Python

Build a support vector machine from scratch in Python with NumPy: hinge loss, gradient descent, margins, support vectors, C, multi-class and the kernel trick.

By theprogrammers team · · 18 min read

Adelie and Chinstrap penguins look alike: similar size, similar colours. But Chinstraps tend to have longer bills for their depth. A support vector machine can learn that rule from measurements, and here you'll build one yourself, with nothing but NumPy, then check that it gives the same answer as scikit-learn.

Building an SVM from scratch in Python is the best way to see that there's no magic inside. A linear SVM is three ideas you've already met: a score w · x + b, a loss that punishes points too close to the boundary (the hinge loss), and a penalty that keeps the margin wide. Put them together, run gradient descent, and you have an SVM. You'll go from the equations to a working LinearSVM class, explore the C setting, extend it to three species, and end with the kernel trick for curved boundaries.

What you need first: support vector machines explained for the idea, and three maths lessons that this one puts to work: the dot product (scores and sides), vector projection (the margin 2 ÷ ‖w‖) and Lagrange multipliers (why only support vectors matter). You'll also use hinge loss and gradient descent.

Key terms

  • Score: w · x + b. Its sign is the predicted class (+1 or −1); its size grows with the distance from the boundary.
  • Functional margin: y × score, the score multiplied by the true label. It's positive when the prediction is right, and at least 1 when the point is outside the street.
  • Hinge loss: max(0, 1 − y × score). Zero for points safely outside the street, growing in a straight line for points inside it or on the wrong side.
  • Soft margin: a margin that allows some points inside the street or on the wrong side, at a cost set by C.
  • Support vectors: the points on the edge of the street or inside it. Only they shape the boundary.

Step 1: the data

Use two features, bill length and bill depth, for Adelie and Chinstrap penguins only. An SVM wants labels of +1 and −1, and its features on similar scales, because the margin is measured as a distance:

Download the data: penguins.csv (15 KB), or from the original source, the palmerpenguins project. The code below loads it for you, so you only need the file to open it in a spreadsheet or work offline: load it with pd.read_csv("penguins.csv").

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.preprocessing import StandardScaler

penguins = sns.load_dataset("penguins").dropna(subset=["bill_length_mm", "bill_depth_mm", "flipper_length_mm", "body_mass_g"])
two = penguins[penguins["species"].isin(["Adelie", "Chinstrap"])]

X = StandardScaler().fit_transform(two[["bill_length_mm", "bill_depth_mm"]])
y = np.where(two["species"] == "Chinstrap", 1, -1)
print("shape:", X.shape)
print("labels:", pd.Series(y).value_counts().to_dict())
shape: (219, 2)
labels: {-1: 151, 1: 68}

StandardScaler turns each feature into "how many standard deviations from the average", so a 1-unit step means the same in both directions; see feature scaling.

Step 2: the equations

A linear SVM has two parameters, the weight vector w and the bias b, and predicts with the sign of the score:

prediction = sign(w · x + b)

From the vector projection lesson, the street between the classes has width 2 ÷ ‖w‖ when the closest points have scores of ±1. A wide street means a small ‖w‖.

Real data overlaps: a few Adelies have Chinstrap-like bills. So a perfect street isn't possible, and the SVM uses a soft margin. It minimises:

J(w, b) = ½‖w‖² + C × Σ max(0, 1 − yᵢ(w · xᵢ + b))

Read it in two parts:

PartIn wordsWhat it wants
½‖w‖²Half the squared length of wA small w: a wide street
C × Σ max(0, 1 − yᵢ(w · xᵢ + b))C times the total hinge lossEvery point outside the street, on its own side

C sets the balance, like the alpha in regularisation but the other way round: a big C means "mistakes are expensive", a small C means "a wide street matters more". With a huge C, no point may break the rule, and you get the hard-margin SVM from the Lagrange multipliers lesson.

The hinge loss for one point, by hand

Take w = (1, −0.5) and b = 0, and three penguins, each with label y = +1:

PointScore w · x + by × scoreHinge loss max(0, 1 − y × score)
(2, 0)220: safely outside the street
(0.5, 0)0.50.50.5: right side, but inside the street
(−1, 1)−1.5−1.52.5: on the wrong side
w, b = np.array([1.0, -0.5]), 0.0
for point in [(2, 0), (0.5, 0), (-1, 1)]:
    score = w @ np.array(point) + b
    print(f"point {point}: score {score:5.2f}, hinge loss {max(0.0, 1 - 1 * score):.2f}")
point (2, 0): score  2.00, hinge loss 0.00
point (0.5, 0): score  0.50, hinge loss 0.50
point (-1, 1): score -1.50, hinge loss 2.50

Step 3: the gradient

To run gradient descent, we need the slope of J for w and b. Work it out piece by piece:

  • The penalty ½‖w‖² = ½(w₁² + w₂²) has slope w (the ½ cancels the 2 from the power rule). It has no b, so its slope for b is 0.
  • The hinge loss of one point is either 0 (flat, slope 0) when y × score ≥ 1, or 1 − y(w · x + b) when y × score < 1. That second piece is a straight line in w and b, with slope −y × x for w and −y for b.

The hinge has a sharp corner at y × score = 1, where the slope jumps. We just pick the flat side there; using such a "slope from one side" is called a subgradient, and gradient descent works fine with it. Adding everything up:

SlopeFormulaIn words
∂J/∂ww − C × Σ yᵢxᵢ, over the points with yᵢ × scoreᵢ < 1Shrink w, and pull it towards each point that's inside the street or wrong
∂J/∂b−C × Σ yᵢ, over the same pointsShift the boundary away from those points

The points with yᵢ × scoreᵢ < 1 are exactly the ones in or beyond the street. Points safely outside the street don't appear in the gradient at all: that's the support vector idea from the Lagrange lesson, showing up again in the gradient.

Step 4: the LinearSVM class

class LinearSVM:
    """A soft-margin linear SVM trained with (sub)gradient descent."""

    def __init__(self, C=1.0, epochs=20000, learning_rate=0.01):
        self.C = C
        self.epochs = epochs
        self.learning_rate = learning_rate

    def objective(self, X, y):
        hinge = np.maximum(0, 1 - y * (X @ self.w_ + self.b_))
        return 0.5 * self.w_ @ self.w_ + self.C * hinge.sum()

    def fit(self, X, y):
        n_rows, n_features = X.shape
        self.w_ = np.zeros(n_features)
        self.b_ = 0.0
        self.history_ = []
        base_step = self.learning_rate / max(1.0, self.C)        # a big C makes big gradients, so take smaller steps
        for epoch in range(self.epochs):
            step = base_step / (1 + epoch / 1000)                # slowly shrinking steps settle at the minimum
            inside = y * (X @ self.w_ + self.b_) < 1             # points in the street or on the wrong side
            grad_w = self.w_ - self.C * (y[inside, None] * X[inside]).sum(axis=0)
            grad_b = -self.C * y[inside].sum()
            self.w_ -= step * grad_w
            self.b_ -= step * grad_b
            if epoch % 10 == 0:
                self.history_.append(self.objective(X, y))
        return self

    def decision_function(self, X):
        return X @ self.w_ + self.b_

    def predict(self, X):
        return np.where(self.decision_function(X) >= 0, 1, -1)

    def support_vectors(self, X, y, tolerance=1e-3):
        return np.where(y * self.decision_function(X) <= 1 + tolerance)[0]

svm = LinearSVM(C=1.0).fit(X, y)
print(f"w = {np.round(svm.w_, 3)}, b = {svm.b_:.3f}")
print(f"objective J = {svm.objective(X, y):.3f}")
print(f"training accuracy: {np.mean(svm.predict(X) == y):.3f}")
print(f"margin width 2 / ‖w‖ = {2 / np.linalg.norm(svm.w_):.3f} (in standardised units)")
w = [ 2.836 -1.008], b = -1.276
objective J = 17.471
training accuracy: 0.968
margin width 2 / ‖w‖ = 0.665 (in standardised units)

Two details in fit matter:

  • The step size shrinks over time. The hinge loss has corners, so a fixed step makes w bounce around near the bottom. Slowly smaller steps let it settle.
  • The step is divided by C. C multiplies the hinge part of the gradient, so with C = 100 the gradient is about 100 times bigger; a smaller step keeps it stable.

Did the objective actually go down?

fig, ax = plt.subplots(figsize=(8, 4))
ax.plot(np.arange(len(svm.history_)) * 10, svm.history_, color="#c2410c")
ax.set_xlim(0, 1000)
ax.set_xlabel("Epoch (first 1,000 of 20,000)")
ax.set_ylabel("Objective J")
ax.set_title("Training the SVM: the objective falls, then settles")
plt.show()
Line chart of the objective J over the first 1,000 epochs. It falls steeply in the first few dozen epochs, then flattens out at about 17.5 and stays there for the rest of training.

Step 5: check against scikit-learn

SVC(kernel="linear") solves exactly the same problem, but with a specialised solver that works on the Lagrange multipliers. Predict first: two completely different methods, gradient descent and a Lagrange-multiplier solver. Will they find the same line, or only a similar one?

from sklearn.svm import SVC

sk_svm = SVC(kernel="linear", C=1.0).fit(X, y)
print(f"scikit-learn: w = {np.round(sk_svm.coef_[0], 3)}, b = {sk_svm.intercept_[0]:.3f}")
print(f"ours:         w = {np.round(svm.w_, 3)}, b = {svm.b_:.3f}")
print(f"same predictions: {np.mean(sk_svm.predict(X) == svm.predict(X)):.3f}")
print(f"support vectors: scikit-learn {len(sk_svm.support_)}, ours {len(svm.support_vectors(X, y))}")
scikit-learn: w = [ 2.836 -1.008], b = -1.276
ours:         w = [ 2.836 -1.008], b = -1.276
same predictions: 1.000
support vectors: scikit-learn 23, ours 23

Our 40-line class and scikit-learn's solver agree to three decimal places: the same weights, the same bias, the same predictions on every penguin, and the same 23 support vectors. Gradient descent on the hinge loss and the Lagrange multiplier method are two routes to the same answer.

Step 6: see the street

def plot_svm(ax, model, X, y, title):
    g1, g2 = np.meshgrid(np.linspace(-2.5, 3, 300), np.linspace(-2.5, 3, 300))
    scores = model.decision_function(np.column_stack([g1.ravel(), g2.ravel()])).reshape(g1.shape)
    ax.contourf(g1, g2, scores, levels=[-100, 0, 100], colors=["#dbeafe", "#fee2e2"], alpha=0.8)
    ax.contour(g1, g2, scores, levels=[-1, 0, 1], colors="black", linestyles=["--", "-", "--"])
    ax.scatter(*X[y == -1].T, s=14, color="#1f5fbf", label="Adelie (−1)")
    ax.scatter(*X[y == 1].T, s=14, color="#c2410c", label="Chinstrap (+1)")
    sv = model.support_vectors(X, y)
    ax.scatter(*X[sv].T, s=80, facecolors="none", edgecolors="black", linewidths=1, label="Support vectors")
    ax.set_title(title)
    ax.set_xlabel("Bill length (standardised)")

fig, ax = plt.subplots(figsize=(7, 6))
plot_svm(ax, svm, X, y, "Our SVM, C = 1")
ax.set_ylabel("Bill depth (standardised)")
ax.legend(loc="upper left")
plt.show()
Scatter plot of standardised bill length against bill depth. Blue Adelie points sit on the left and orange Chinstrap points on the right. A solid diagonal boundary line separates a blue background region on the left from a red one on the right, with dashed lines on either side marking the edges of the street. About two dozen points are circled as support vectors: those on the dashed lines, inside the street, or on the wrong side of the boundary.

Every circled point is in the street or on the wrong side. Delete any uncircled point and retrain, and the line wouldn't move.

Experiment: test that claim. Remove every penguin that is not a support vector, keeping only the 23 circled ones, and retrain. Then remove one support vector instead. Predict which of the two changes the line:

sv = svm.support_vectors(X, y)
only_sv = LinearSVM(C=1.0).fit(X[sv], y[sv])
print(f"all {len(X)} penguins:     w = {np.round(svm.w_, 3)}, b = {svm.b_:.3f}")
print(f"only {len(sv)} support vectors: w = {np.round(only_sv.w_, 3)}, b = {only_sv.b_:.3f}")

keep = np.ones(len(X), dtype=bool)
keep[sv[0]] = False
minus_one = LinearSVM(C=1.0).fit(X[keep], y[keep])
print(f"one support vector removed: w = {np.round(minus_one.w_, 3)}, b = {minus_one.b_:.3f}")
all 219 penguins:     w = [ 2.836 -1.008], b = -1.276
only 23 support vectors: w = [ 2.836 -1.008], b = -1.276
one support vector removed: w = [ 2.909 -0.981], b = -1.222

Throwing away 196 of the 219 penguins, every one that isn't a support vector, gives exactly the same line, to three decimal places. Removing a single support vector moves it. That's the whole idea of the method in one result: the boundary depends only on the points on or inside the street. It also explains why SVMs can be robust to far-away points, which never become support vectors, but sensitive to mislabelled points near the boundary, which do.

Step 7: what C does

fig, axes = plt.subplots(1, 3, figsize=(15, 5), sharey=True)
for ax, C in zip(axes, [0.01, 1, 100]):
    model = LinearSVM(C=C).fit(X, y)
    plot_svm(ax, model, X, y, f"C = {C}")
    print(f"C = {C:<5}: margin {2 / np.linalg.norm(model.w_):.2f}, "
          f"support vectors {len(model.support_vectors(X, y)):3}, accuracy {np.mean(model.predict(X) == y):.3f}")
axes[0].set_ylabel("Bill depth (standardised)")
plt.tight_layout()
plt.show()
C = 0.01 : margin 2.36, support vectors 129, accuracy 0.954
C = 1    : margin 0.66, support vectors  23, accuracy 0.968
C = 100  : margin 0.32, support vectors  12, accuracy 0.977
Three scatter plots of the same Adelie and Chinstrap penguins with the SVM street drawn on each. With C = 0.01 the street is very wide, covering much of the chart, and many points are circled as support vectors. With C = 1 the street is narrower with about two dozen support vectors. With C = 100 the street is narrowest, and fewer points are circled.

With C = 0.01, mistakes are cheap, so the SVM chooses a wide street (2.36 units) that contains 129 of the 219 penguins: more than half are support vectors, and it misclassifies a few more (0.954). With C = 100, mistakes are expensive: the street shrinks to 0.32 units, only 12 points are support vectors, and the training accuracy rises to 0.977. Higher training accuracy isn't automatically better: a narrow street fitted tightly to a few borderline penguins can generalise worse. Choose C with cross-validation.

Step 8: three species, one-vs-rest

An SVM separates two classes. For three, train one SVM per species, "this species (+1) against the rest (−1)", and predict the species whose SVM gives the highest score. This is called one-vs-rest. Use all four measurements now, with a proper train/test split:

from sklearn.model_selection import train_test_split
from sklearn.multiclass import OneVsRestClassifier

features = ["bill_length_mm", "bill_depth_mm", "flipper_length_mm", "body_mass_g"]
X_all, species = penguins[features].values, penguins["species"].values
X_train, X_test, y_train, y_test = train_test_split(X_all, species, test_size=0.25, stratify=species, random_state=0)
scaler = StandardScaler().fit(X_train)                   # learn the scaling from training data only
X_train, X_test = scaler.transform(X_train), scaler.transform(X_test)

classes = np.unique(y_train)
models = [LinearSVM(C=1.0).fit(X_train, np.where(y_train == c, 1, -1)) for c in classes]
all_scores = np.column_stack([m.decision_function(X_test) for m in models])
our_predictions = classes[np.argmax(all_scores, axis=1)]

sk_ovr = OneVsRestClassifier(SVC(kernel="linear", C=1.0)).fit(X_train, y_train)
print("classes:", classes.tolist())
print(f"our test accuracy:          {np.mean(our_predictions == y_test):.3f}")
print(f"scikit-learn test accuracy: {sk_ovr.score(X_test, y_test):.3f}")
print(f"identical predictions:      {np.mean(our_predictions == sk_ovr.predict(X_test)):.3f}")
classes: ['Adelie', 'Chinstrap', 'Gentoo']
our test accuracy:          0.988
scikit-learn test accuracy: 0.988
identical predictions:      1.000

Three of our SVMs, one per species, classify 98.8% of the unseen test penguins correctly, and make exactly the same prediction as scikit-learn's one-vs-rest SVMs for every one of them.

Step 9: curved boundaries and the kernel trick

A straight line can't separate data in rings. Make some, and try the linear SVM:

from sklearn.datasets import make_circles

X_ring, y_ring01 = make_circles(n_samples=300, noise=0.08, factor=0.4, random_state=0)
y_ring = np.where(y_ring01 == 1, 1, -1)                  # inner ring +1, outer ring -1

flat = LinearSVM(C=1.0).fit(X_ring, y_ring)
print(f"straight line on rings: accuracy {np.mean(flat.predict(X_ring) == y_ring):.3f}")
straight line on rings: accuracy 0.583

58.3% is barely better than always guessing "outer ring". Whatever straight line the SVM draws, rings sit on both sides of it.

The fix: add a feature. The inner ring is close to the centre and the outer ring is far away, so add a third feature: the squared distance from the centre, x₁² + x₂². In 3D, the inner ring sits low and the outer ring high, and a flat sheet separates them:

X_lifted = np.column_stack([X_ring, (X_ring ** 2).sum(axis=1)])
lifted = LinearSVM(C=1.0).fit(X_lifted, y_ring)
print(f"with the extra feature: accuracy {np.mean(lifted.predict(X_lifted) == y_ring):.3f}")
print("weights:", np.round(lifted.w_, 3), f"b = {lifted.b_:.3f}")
with the extra feature: accuracy 1.000
weights: [-0.052 -0.113 -4.195] b = 2.163

With the extra feature, the linear SVM separates the rings perfectly. Look at the weights: the first two are almost 0, and the third, for x₁² + x₂², is −4.195. The model has learnt "inner ring if the squared distance from the centre is less than about 2.163 ÷ 4.195 ≈ 0.52": a circle, drawn by a linear model in a lifted space.

The kernel trick does this without ever building the new features. The SVM's solver only ever needs dot products between pairs of points, xᵢ · xⱼ, because of the way the Lagrange multipliers rewrite the problem. A kernel is a function that gives the dot product of the lifted points directly from the original ones. For example, lifting (x₁, x₂) to φ(x) = (x₁², √2·x₁x₂, x₂²) has the kernel k(a, b) = (a · b)²:

def lift(v):
    return np.array([v[0] ** 2, np.sqrt(2) * v[0] * v[1], v[1] ** 2])

a, c = np.array([1.0, 2.0]), np.array([3.0, 1.0])
print(f"dot product after lifting: {lift(a) @ lift(c):.3f}")
print(f"kernel (a · c)²:           {(a @ c) ** 2:.3f}")
dot product after lifting: 25.000
kernel (a · c)²:           25.000

Same number, without building the lifted vectors. With 2 features that saves little, but the RBF kernel corresponds to infinitely many features, which could never be built at all. Our gradient-descent class works on w directly, so it can't use kernels; scikit-learn's SVC solves the Lagrange multiplier form, so it can:

rbf = SVC(kernel="rbf", C=1.0).fit(X_ring, y_ring)
print(f"RBF kernel SVM on rings: accuracy {rbf.score(X_ring, y_ring):.3f}, support vectors {len(rbf.support_)}")
RBF kernel SVM on rings: accuracy 1.000, support vectors 31

How our version compares

Our LinearSVMscikit-learn SVC / LinearSVC
Linear boundaryYes, same answerYes
Kernels (curved boundaries)No: works on w directlySVC yes, through the dual form
Speed on large dataSlow: full gradient every stepFast, specialised solvers (LinearSVC scales to millions of rows)
ProbabilitiesNoSVC(probability=True), slower
Multi-classOne-vs-rest, by handBuilt in

Ours is for understanding; use scikit-learn in practice.

Common mistakes

  • Labels of 0 and 1. The hinge loss needs −1 and +1. With 0, the gradient for those points vanishes and the model learns nothing about them.
  • Unscaled features. The margin is a distance, so a feature in grams would swamp one in millimetres. Scale first, fitted on the training data only.
  • A fixed, large step size. The hinge's corners make the weights bounce. Use a shrinking step, and a smaller one for large C.
  • Thinking the kernel trick is "just adding features". It's the same result, but computed through dot products, which is what makes infinite-dimensional kernels such as RBF possible.

Practice

  1. For w = (2, 1), b = −1 and a point x = (1, 0) with label y = −1, compute the score, y × score and the hinge loss. Is the point a support vector?
Show the answer

Score = 2 × 1 + 1 × 0 − 1 = 1. y × score = −1 × 1 = −1. Hinge loss = max(0, 1 − (−1)) = 2. It's on the wrong side, so yes: it's inside the hinge region and pulls on the gradient, which makes it a support vector.

  1. Train our LinearSVM with C = 1 using bill length only. What's the accuracy, and why is it lower?
Show the answer
one_feature = LinearSVM(C=1.0).fit(X[:, [0]], y)
print(f"bill length only: accuracy {np.mean(one_feature.predict(X[:, [0]]) == y):.3f}")
bill length only: accuracy 0.959

Bill length alone gives 0.959, only a little below 0.968 with both features. Bill length does most of the work in separating Adelie from Chinstrap, and bill depth adds a little: the boundary in Step 6 is steep, so it mostly cuts on length.

  1. Change the labels to 0 and 1 (y01 = (y == 1).astype(int)) and train. What happens?
Show the answer
y01 = (y == 1).astype(int)
broken = LinearSVM(C=1.0).fit(X, y01)
print(f"w = {np.round(broken.w_, 3)}, b = {broken.b_:.3f}, predicts +1 for {np.mean(broken.predict(X) == 1):.0%} of penguins")
w = [0. 0.], b = 1.064, predicts +1 for 100% of penguins

The weights stay at zero and the model predicts +1 for every penguin. With label 0, y × score is always 0, which is less than 1, so every Adelie is "inside the street", but its pull on the gradient, y × x, is 0 × x = 0. Only the Chinstraps pull, and they all pull b upwards. The hinge loss needs labels of −1 and +1.

  1. Why does the gradient never include points with y × score > 1? What does that mean for the final model?
Show the answer

For those points the hinge loss is flat at 0, so its slope is 0: they don't push on w or b at all. The final boundary is therefore decided only by points with y × score ≤ 1, the support vectors, exactly as the Lagrange multipliers lesson showed with α = 0 for points beyond the margin.

Interview questions

What is the objective function of a soft-margin SVM?

Minimise ½‖w‖² + C Σ max(0, 1 − yᵢ(w · xᵢ + b)): the first term maximises the margin, the second is the total hinge loss for points inside the margin or misclassified, and C trades them off. Equivalently, it's hinge loss with L2 regularisation.

How would you train a linear SVM on a very large dataset?

Use the primal form with stochastic or mini-batch subgradient descent (as in SGDClassifier with hinge loss) or a coordinate descent solver such as liblinear's LinearSVC. Their cost grows linearly with the number of rows, unlike kernel SVC, whose training time grows roughly with the square or cube of the number of rows.

What is the kernel trick?

SVM training and prediction in the dual form depend on the data only through dot products xᵢ · xⱼ. A kernel function k(xᵢ, xⱼ) returns the dot product of the points after a mapping into a higher-dimensional space, without computing the mapping. This gives non-linear boundaries at the cost of a linear SVM in kernel space; the RBF kernel corresponds to an infinite-dimensional mapping.

Key takeaways

  • A linear SVM minimises ½‖w‖² + C × total hinge loss: a wide street plus few points inside it.
  • The hinge gradient is zero for points safely outside the street, so only support vectors shape the boundary.
  • Subgradient descent with a shrinking step reproduces scikit-learn's answer to three decimal places.
  • Small C gives a wide street with many support vectors; large C a narrow street that tries to classify every point.
  • One-vs-rest handles several classes; kernels give curved boundaries by replacing dot products, which needs the dual (Lagrange) form.

Frequently asked questions

Is an SVM just logistic regression with a different loss?

For linear models, very nearly: both are L2-regularised linear classifiers. Logistic regression uses log loss, which never reaches zero and gives probabilities; the SVM uses hinge loss, which is exactly zero beyond the margin, so only support vectors matter. Their accuracy is often similar.

Why use −1 and +1 instead of 0 and 1?

Because the margin y × score must be positive for a correct prediction on both classes. With labels of ±1, multiplying by y flips the score for the negative class, so one formula, max(0, 1 − y × score), works for both.

Can I train an SVM with stochastic gradient descent?

Yes: use one row (or a small batch) per step instead of the whole dataset. scikit-learn's SGDClassifier(loss="hinge") is exactly that, and it's fast on large datasets.

What to learn next

  1. Use an SVM on a real image problem in the handwritten digit recognition project, the next lesson.
  2. Review margins, C and kernels in support vector machines explained.
  3. Revisit why only support vectors matter in Lagrange multipliers explained.