svmTrain()
function is the SMO method. That method is too complex to be included as part of the course. – from Discuss Forms$h_{\theta}(x) = \left\{ \begin{array}{rl} 1 & \text{, if } \theta^Tx \ge 0 \\ 0 & \text{, } \text{otherwise}. \end{array} \right.$
Put landmarks as exactly the same locations as the training examples.
Then we will get m landmarks, which has the same number with the training examples.
SVM with Kernels
Given $(x^{(1)}, y^{(1)}), (x^{(2)}, y^{(2)}), \ldots, (x^{(m)}, y^{(m)})$,
Choose $l^{(1)} = x^{(1)}, l^{(2)} = x^{(2)}, \ldots, l^{(m)} = x^{(m)}$.
For training example ($x^{(i)}, y^{(i)}$): $$\begin{aligned}
f_1^{(i)} &= \text{similarity}(x^{(i)}, l^{(1)}) \
f_2^{(i)} &= \text{similarity}(x^{(i)}, l^{(2)}) \
&\vdots \
f_i^{(i)} &= \text{similarity}(x^{(i)}, l^{(i)}) = \text{similarity}(x^{(i)}, x^{(i)}) = \text{exp}(-\frac{0}{2\sigma^2}) = 1\
&\vdots \
f_m^{(i)} &= \text{similarity}(x^{(i)}, l^{(m)})
\end{aligned}$$
We got $f^{(i)} = \begin{bmatrix}f_0^{(i)} \\ f_1^{(i)} \\ \vdots \\ f_m^{(i)} \\ \end{bmatrix}$($f_0^{(i)} = 1$), which are our new training examples.
Then, our hypothesis will be: Given $x$, compute features $f^{(i)} \in \mathbb{R}^{m+1}$. Predict $y = 1$ if $\theta^Tf \ge 0$.
And the training: $$\underset{\theta}{\text{min} }\ C \sum_{i=1}^m \large[ y^{{(i)} cost_1(\theta}Tf^{(i)}) + (1 - y^{{(i)}) cost_0(\theta}Tf^{(i)})\large] + \frac{1}{2}\sum_{j=1}^m \theta_j^2$$
You can apply kernels to other algorithms