Skip to content
BIASED

Kernels

Block 1 of 8~2 min

Lifting the data

The topic Support vector machines ended with two facts. Its dual problem and its classifier touch the training points only through inner products ⟨xi,xj⟩\langle x_i, x_j \rangle. And whatever CC we pick, the boundary is a hyperplane in the original features. As there, the classes are y∈{−1,+1}y \in \{-1, +1\}.

A hyperplane is not always enough. Take XOR, four points in the plane:

  • (1,1)(1, 1) and (−1,−1)(-1, -1) belong to class +1+1;
  • (1,−1)(1, -1) and (−1,1)(-1, 1) belong to class −1-1.

No line separates them, and a linear SVM gets two of the four right.

The fix is to give the linear model better features. A feature map φ\varphi sends each object xx to a vector φ(x)\varphi(x) in a richer space, and the model stays linear there: f(x)=⟨w,φ(x)⟩+bf(x) = \langle w, \varphi(x) \rangle + b. For XOR one extra coordinate is enough:

φ(x)=(x1, x2, x1x2).\varphi(x) = (x_1,\ x_2,\ x_1 x_2) .

The third coordinate separates the classes on its own, so w=(0,0,1)w = (0, 0, 1) and b=0b = 0 do the job. A plane in the lifted space becomes a curve in the original one: here the boundary x1x2=0x_1 x_2 = 0 is the pair of coordinate axes.

In general we do not know which product to add, so we add them all. All products of features up to degree pp are the monomials of degree at most pp, and in dd variables there are

(d+pp)\binom{d + p}{p}

of them. For d=100d = 100 and p=3p = 3 that is 176,851176{,}851 features per object, each with its own weight. Writing them down quickly becomes the bottleneck. This topic shows how to use them without ever writing them down.

Answers are saved on the server and tied to this browser until you sign in.