Before you readOn a square, the opposite corners have the same label. No line separates the two classes. Could one extra feature make that possible?
Watch: Support Vector Machines: The Polynomial Kernel · StatQuest with Josh Starmer
Label the corners of the square (±1,±1) by the sign of x1x2. The two diagonals meet, so no line puts their endpoints on opposite sides. Add the feature z=x1x2. Now the positive points sit at z=1, the negative ones at z=−1, and the plane z=0 separates them.
The circles (+1) and squares (−1) alternate. Lift each point to height z=x1x2 to separate them.
A feature mapϕ(x) turns an input into new coordinates. A linear boundary there can be curved or split into pieces in the original coordinates. Here the plane z=0 means x1x2=0: both original axes form the boundary.
The dual SVM needs dot products, not the feature coordinates themselves. A kernel returns that dot product directly:
K(x,u)=ϕ(x)Tϕ(u).
Replace every training dot product with K(xi,xj), then score a new point with f(x)=∑iαiyiK(xi,x)+b. This is the kernel trick: work as if the features had been expanded, without building every coordinate.
For example, the degree-two polynomial kernel K(x,u)=(xTu)2 in two dimensions expands to
x12u12+2x1x2u1u2+x22u22.
That is the dot product of feature vectors with coordinates x12,2x1x2 and x22. The middle coordinate does the separating in the square. Another common choice, the RBF kernel, is K(x,u)=exp(−γ∥x−u∥2) with γ>0. Its value is 1 at identical points and drops towards 0 with distance. Larger γ makes that drop quicker; scale the input features so their units do not dominate the distance.
Recall
What does a kernel return, and why is that enough for the dual SVM?
Recall
How does increasing γ change an RBF kernel?
Exercise
For x=(1,2)T and u=(3,−1)T, evaluate K(x,u)=(xTu)2 without expanding either vector into new features.
Exercise
In the square example, use f(x)=x1x2. Give the class labels for (2,−1) and (−2,−1), in that order.