Support vector machines.

A support vector machine separates two kinds of point with the widest possible empty street. Only the points on the edge of the street decide where it goes. These figures let you build one by hand, then let the algorithm do it.

From Chapter 10: Support Vector Machines, which explains these figures step by step.

Figure

Build the widest street you can

Filled kind at (5.54, 7.78)Filled kind at (6.95, 6.37)Filled kind at (6.48, 6.61)Filled kind at (7.38, 5.68)Filled kind at (5.72, 5.35)Filled kind at (6.91, 6.75)Filled kind at (6.78, 7.02)Filled kind at (6.31, 6.17)Filled kind at (6.91, 5.9)Filled kind at (6.44, 6.43)Filled kind at (6.38, 7.51)Filled kind at (6.86, 6.08)Hollow kind at (3.28, 4.54)Hollow kind at (3.18, 3.29)Hollow kind at (2.59, 4.04)Hollow kind at (3.41, 3.21)Hollow kind at (3.78, 3.27)Hollow kind at (2.47, 4.76)Hollow kind at (2.83, 3.75)Hollow kind at (2.9, 3.57)Hollow kind at (3.53, 3.77)Hollow kind at (3.3, 3.35)Hollow kind at (4.54, 4.45)Hollow kind at (4.83, 4.01)
  • Your line
  • Edges of your street
Separates the two kinds?
yes
Width of your street
0.20
Widest possible
?
Drag the two orange handles.
The solid line is your boundary. The dashed lines are the edges of the widest empty street centred on it. Try it: drag the two handles to make your street as wide as possible. Then reveal the best possible street and compare.
Figure

How much to mind the awkward points

6.82, 4.745.38, 4.987.36, 4.385.61, 3.593.08, 5.973.18, 4.355.24, 4.955.1, 5.074.11, 4.75Filled kind at (8.07, 5.94)Filled kind at (5.78, 9.29)Filled kind at (6.82, 4.74)Filled kind at (5.38, 4.98)Filled kind at (8.51, 6.43)Filled kind at (7.62, 8.17)Filled kind at (7.15, 7.17)Filled kind at (6.62, 8.86)Filled kind at (9.19, 6.59)Filled kind at (3.97, 6.4)Filled kind at (3.08, 5.97)Filled kind at (7.27, 7.89)Filled kind at (7.94, 5.63)Filled kind at (5.1, 5.07)Filled kind at (5.66, 5.51)Filled kind at (8.53, 6.54)Filled kind at (6.48, 5.02)Filled kind at (8.44, 8.37)Filled kind at (6.02, 7.67)Filled kind at (8.23, 5.22)Filled kind at (5.07, 6.66)Filled kind at (6.17, 6.03)Hollow kind at (1.5, 1.78)Hollow kind at (3.73, 2.08)Hollow kind at (0.81, 4.52)Hollow kind at (1.77, 4.42)Hollow kind at (2.59, 2.28)Hollow kind at (4.96, 3.77)Hollow kind at (2.86, 4.07)Hollow kind at (7.36, 4.38)Hollow kind at (5.61, 3.59)Hollow kind at (3.23, 2.76)Hollow kind at (4.54, 2.27)Hollow kind at (3.18, 4.35)Hollow kind at (5.24, 4.95)Hollow kind at (0.89, 3.74)Hollow kind at (4.07, 2.59)Hollow kind at (4.11, 4.75)Hollow kind at (4.69, 2.58)Hollow kind at (1.79, 3.92)Hollow kind at (3.16, 2.92)Hollow kind at (2.2, 2.15)Hollow kind at (2.64, 3.97)Hollow kind at (3.57, 3.37)
  • Boundary and street edges
  • Ringed: support vector
Cost of a violation (C)
1
Street width
1.52
Points inside the street
6
On the wrong side
2
1
The two groups overlap, so some points must end up inside the street or on the wrong side. Try it: slide C from 100 down to 0.001. Watch the street widen and the number of ringed points grow.
Figure

A boundary that closes into a loop

2.88, 1.525.43, 5.29.73, 4.110.51, 6.374.01, 5.128.77, 4.716.11, 4.63.78, 1.366.26, 4.545.8, 7.795.66, 3.822.26, 3.535.72, 4.294.53, 8.265.36, 6.243.23, 2.294.84, 5.614.71, 8.360.56, 4.994.68, 5.053.68, 2.75.93, 4.541.53, 2.95.93, 4.32.42, 6.395.51, 6.38.07, 7.274.89, 3.943.92, 4.826.57, 7.553.72, 5.815.23, 5.083.87, 5.891.98, 7.564.53, 3.847.53, 6.493.89, 4.298.43, 4.174.14, 4.414.73, 8.524.87, 4.374.96, 8.785.98, 6.018.14, 4.143.71, 7.824.88, 5.622.49, 3.386.04, 4.968.54, 5.784.49, 4.388.18, 2.622.9, 5.992.57, 2.163.91, 5.451.9, 6.583.91, 4.837.87, 2.895.06, 5.011.85, 2.443.81, 5.596.4, 1.983.87, 4.867.42, 3.455.53, 6.13Filled kind at (5.43, 5.2)Filled kind at (3.61, 6.26)Filled kind at (4.01, 5.12)Filled kind at (6.11, 4.6)Filled kind at (6.26, 4.54)Filled kind at (5.66, 3.82)Filled kind at (5.72, 4.29)Filled kind at (5.36, 6.24)Filled kind at (4.84, 5.61)Filled kind at (3.91, 6.3)Filled kind at (4.68, 5.05)Filled kind at (5.93, 4.54)Filled kind at (5.93, 4.3)Filled kind at (5.51, 6.3)Filled kind at (4.89, 3.94)Filled kind at (3.92, 4.82)Filled kind at (3.72, 5.81)Filled kind at (5.23, 5.08)Filled kind at (3.87, 5.89)Filled kind at (4.53, 3.84)Filled kind at (3.89, 4.29)Filled kind at (4.14, 4.41)Filled kind at (4.87, 4.37)Filled kind at (5.98, 6.01)Filled kind at (3.96, 6.71)Filled kind at (4.88, 5.62)Filled kind at (6.04, 4.96)Filled kind at (4.49, 4.38)Filled kind at (2.9, 5.99)Filled kind at (3.91, 5.45)Filled kind at (3.91, 4.83)Filled kind at (5.06, 5.01)Filled kind at (3.81, 5.59)Filled kind at (3.87, 4.86)Filled kind at (5.53, 6.13)Hollow kind at (2.88, 1.52)Hollow kind at (9.73, 4.11)Hollow kind at (0.51, 6.37)Hollow kind at (8.77, 4.71)Hollow kind at (3.78, 1.36)Hollow kind at (5.8, 7.79)Hollow kind at (2.26, 3.53)Hollow kind at (4.53, 8.26)Hollow kind at (3.23, 2.29)Hollow kind at (4.71, 8.36)Hollow kind at (0.56, 4.99)Hollow kind at (3.68, 2.7)Hollow kind at (1.53, 2.9)Hollow kind at (2.42, 6.39)Hollow kind at (8.07, 7.27)Hollow kind at (5.54, 1.08)Hollow kind at (6.57, 7.55)Hollow kind at (4.54, 1.47)Hollow kind at (6.53, 1.93)Hollow kind at (1.98, 7.56)Hollow kind at (7.53, 6.49)Hollow kind at (8.43, 4.17)Hollow kind at (4.73, 8.52)Hollow kind at (4.96, 8.78)Hollow kind at (8.14, 4.14)Hollow kind at (3.71, 7.82)Hollow kind at (2.49, 3.38)Hollow kind at (8.54, 5.78)Hollow kind at (8.18, 2.62)Hollow kind at (2.57, 2.16)Hollow kind at (1.9, 6.58)Hollow kind at (7.87, 2.89)Hollow kind at (1.85, 2.44)Hollow kind at (6.4, 1.98)Hollow kind at (7.42, 3.45)
  • Shaded: would be called filled
  • Ringed: support vector
Boundary
straight line
Points classified correctly
73%
Support vectors
64 of 70
0.32
Shaded areas would be classified as the filled kind. Try it: with the straight boundary, read the accuracy. Switch to RBF, then move γ to its smallest and largest values and count the support vectors.

Learn the ideas behind it

More playgrounds

Search

    The Book of Machine Learning
    Search
    Reading settings
    Text size
    Colours

    Saved in this browser only.

    Keyboard shortcuts
    /
    Search the book
    ← →
    Previous and next chapter
    g
    Glossary
    c
    Table of contents
    e
    Jump to the exercises
    t
    Reading settings
    ?
    Show this list
    Esc
    Close a window or pop-in