Skip to content

Commit

Permalink
Merge pull request #170 from slds-lmu/fix-kernel
Browse files Browse the repository at this point in the history
fix typo in slides-nonlinsvm-kernel-poly.tex
  • Loading branch information
sandylaker authored Dec 12, 2023
2 parents 3e675a2 + 1ff67ea commit 7d73292
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 2 deletions.
Binary file modified slides-pdf/slides-nonlinsvm-featuregen.pdf
Binary file not shown.
Binary file modified slides-pdf/slides-nonlinsvm-kernel-poly.pdf
Binary file not shown.
Binary file modified slides-pdf/slides-nonlinsvm-kernel-rbf.pdf
Binary file not shown.
Binary file modified slides-pdf/slides-nonlinsvm-kernel-trick.pdf
Binary file not shown.
Binary file modified slides-pdf/slides-nonlinsvm-modelsel.pdf
Binary file not shown.
Binary file modified slides-pdf/slides-nonlinsvm-rkhs-repr.pdf
Binary file not shown.
Binary file modified slides-pdf/slides-nonlinsvm-uniapprox.pdf
Binary file not shown.
7 changes: 5 additions & 2 deletions slides/nonlinear-svm/slides-nonlinsvm-kernel-poly.tex
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,16 @@
\end{vbframe}

\begin{vbframe}{NonHomogeneous Polynomial Kernel}
\small
$$k(\xv, \xtil) = (\xv^T \xtil + b)^d, \text{ for } b\geq 0, d \in \N$$
The maths is very similar as before, we kind of add a further constant term in the original space, with
$$ (\xv^T \xtil + b)^d = (x_1 \tilde{x}_1 + \ldots + x_p \tilde{x_p} + \sqrt{b} \sqrt{b})^d$$
$$ (\xv^T \xtil + b)^d = (x_1 \tilde{x}_1 + \ldots + x_p \tilde{x_p} + b)^d$$
The feature map contains all monomials up to order $d$.
$$\phix = \left( \sqrt{\mat{d \\ k_1, \ldots, k_{p+1}}} x_1^{k_1} \ldots x_p^{k_p} b^{k_{p+1}/2} \right)_{k_i \geq 0, \sum_i k_i = d}$$
The map $\phix$ has $\mat{p + d\\ d}$ dimensions. For $p=d=2$:
$$\phix = (x_1^2, x_2^2, \sqrt{2} x_1 x_2, \sqrt{2b} x_1, \sqrt{2b} x_2, \sqrt{b})$$
$$(x_1 \tilde{x}_1 + x_2 \tilde{x}_2 + b)^2 = x_1^2\tilde{x}_1^2 + x_2^2 \tilde{x}_2^2 + 2 x_1 x_2 \tilde{x}_1 \tilde{x}_2 + 2b x_1 \tilde{x}_1 + 2b x_2 \tilde{x}_2 + b^2$$
Therefore,
$$\phix = (x_1^2, x_2^2, \sqrt{2} x_1 x_2, \sqrt{2b} x_1, \sqrt{2b} x_2, b)$$
% From the sum-product rules it directly follows that this is a kernel.
\end{vbframe}

Expand Down

0 comments on commit 7d73292

Please sign in to comment.