update week 48
This commit is contained in:
@@ -261,9 +261,9 @@ MathJax.Hub.Config({
|
||||
<h2 id="___sec5" class="anchor">The equations </h2>
|
||||
|
||||
<p>
|
||||
Suppose we define a polynomial transformation of degree two only (we continue to live in a plane with \( x_i \) and \( y_i \) as variables)
|
||||
Suppose we define a polynomial transformation of degree two only (we continue to live in a plane with \( x_i \) and \( y_i \) as variables). We define a vector \( \boldsymbol{x}_i=[x_i,y_i] \) and have
|
||||
$$
|
||||
z = \phi(x_i) =\left(1, \sqrt{2}x_i, \sqrt{2}y_i, x_i^2, y_i^2, \sqrt{2}x_iy_i\right).
|
||||
\boldsymbol{z}_i = \phi(\boldsymbol{x}_i)^T =\left(1, \sqrt{2}x_i, \sqrt{2}y_i, x_i^2, y_i^2, \sqrt{2}x_iy_i\right).
|
||||
$$
|
||||
|
||||
<p>
|
||||
@@ -291,10 +291,10 @@ $$
|
||||
<p>
|
||||
We note that this dot product can be rewritten as
|
||||
$$
|
||||
K(\boldsymbol{x}_i,\boldsymbol{x}_j)=[1+\boldsymbol{x}^T\boldsymbol{x}']^d,
|
||||
K(\boldsymbol{x}_i,\boldsymbol{x}_j)=[1+\boldsymbol{x}_i^T\boldsymbol{x}_j]^d,
|
||||
$$
|
||||
|
||||
where \( d=2 \) in our case and \( \boldsymbol{x}=[x_i,y_i] \) and \( \boldsymbol{x}=[x_j,y_j] \).
|
||||
where \( d=2 \) in our case and \( \boldsymbol{x}_i=[x_i,y_i] \) and \( \boldsymbol{x}_j=[x_j,y_j] \).
|
||||
To compute the last equation is however inefficient from a computational stand.
|
||||
Instead of computing the last equation for the kernel, we simply compute
|
||||
the dot product \( (\boldsymbol{x}_i^T\boldsymbol{x}_j)^2 \).
|
||||
|
||||
@@ -273,14 +273,11 @@ $$
|
||||
<ol>
|
||||
<li> With a given kernel we can thus define the matrix \( \boldsymbol{P} \).</li>
|
||||
<li> The matrix \( \boldsymbol{P} \) has matrix elements \( p_{ij}=y_iy_jK(\boldsymbol{x}_i,\boldsymbol{x}_j) \). Given a kernel \( K \) and the targets \( y_i \) this matrix is easy to set up.</li>
|
||||
<li> The \( \boldsymbol{q} \) is zero.</li>
|
||||
<li> The vector \( \boldsymbol{q} \) is zero.</li>
|
||||
<li> The constraint \( \boldsymbol{y}^T\boldsymbol{\lambda}=0 \) leads to \( f=0 \) and \( \boldsymbol{A}=\boldsymbol{y} \).</li>
|
||||
<li> To set up the matrix \( \boldsymbol{G} \) we note that the inequalities \( 0\leq \lambda_i \leq C \) can be split up into</li>
|
||||
<li> To set up the matrix \( \boldsymbol{G} \) we note that the inequalities \( 0\leq \lambda_i \leq C \) can be split up into \( 0\leq \lambda_i \) and \( \lambda_i \leq C \). These two inequalities define then the matrix \( \boldsymbol{G} \) and the vector \( \boldsymbol{h} \).</li>
|
||||
</ol>
|
||||
|
||||
\( 0\leq \lambda_i \) and \( \lambda_i \leq C \). These two inequalities define then the matrix \( \boldsymbol{G} \) and the vector \( \boldsymbol{h} \).
|
||||
|
||||
<p>
|
||||
<p>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
<ul class="pagination">
|
||||
|
||||
@@ -270,18 +270,18 @@ $$
|
||||
0& 0 & -1 & \dots & 0 \\
|
||||
\dots& \dots & \dots & \dots & \dots \\
|
||||
0& 0 & 0 & \dots & -1 \\
|
||||
-& 0 & 0 & \dots & 0 \\
|
||||
1 & 0 & 0 & \dots & 0 \\
|
||||
0& 1 & 0 & \dots & 0 \\
|
||||
0& 0 & 1 & \dots & 0 \\
|
||||
\dots& \dots & \dots & \dots & \dots \\
|
||||
0& 0 & 0 & \dots & 1 \\
|
||||
\end{bmatrix}\boldsymbol{\lambda}
|
||||
\end{bmatrix}
|
||||
\begin{bmatrix} \lambda_1 \\
|
||||
\lambda_2 \\
|
||||
\lambda_3 \\
|
||||
\dots \\
|
||||
\lambda_n \\
|
||||
\end{bmatrix}\boldsymbol{\lambda}=
|
||||
\end{bmatrix}=
|
||||
\begin{bmatrix} 0 \\
|
||||
0 \\
|
||||
0 \\
|
||||
@@ -292,7 +292,7 @@ C \\
|
||||
C \\
|
||||
\dots \\
|
||||
C \\
|
||||
\end{bmatrix}\boldsymbol{\lambda}
|
||||
\end{bmatrix}.
|
||||
$$
|
||||
|
||||
<p>
|
||||
|
||||
@@ -294,10 +294,10 @@ plt.show()
|
||||
<h2 id="___sec5">The equations </h2>
|
||||
|
||||
<p>
|
||||
Suppose we define a polynomial transformation of degree two only (we continue to live in a plane with \( x_i \) and \( y_i \) as variables)
|
||||
Suppose we define a polynomial transformation of degree two only (we continue to live in a plane with \( x_i \) and \( y_i \) as variables). We define a vector \( \boldsymbol{x}_i=[x_i,y_i] \) and have
|
||||
<p> <br>
|
||||
$$
|
||||
z = \phi(x_i) =\left(1, \sqrt{2}x_i, \sqrt{2}y_i, x_i^2, y_i^2, \sqrt{2}x_iy_i\right).
|
||||
\boldsymbol{z}_i = \phi(\boldsymbol{x}_i)^T =\left(1, \sqrt{2}x_i, \sqrt{2}y_i, x_i^2, y_i^2, \sqrt{2}x_iy_i\right).
|
||||
$$
|
||||
<p> <br>
|
||||
|
||||
@@ -335,11 +335,11 @@ $$
|
||||
We note that this dot product can be rewritten as
|
||||
<p> <br>
|
||||
$$
|
||||
K(\boldsymbol{x}_i,\boldsymbol{x}_j)=[1+\boldsymbol{x}^T\boldsymbol{x}']^d,
|
||||
K(\boldsymbol{x}_i,\boldsymbol{x}_j)=[1+\boldsymbol{x}_i^T\boldsymbol{x}_j]^d,
|
||||
$$
|
||||
<p> <br>
|
||||
|
||||
where \( d=2 \) in our case and \( \boldsymbol{x}=[x_i,y_i] \) and \( \boldsymbol{x}=[x_j,y_j] \).
|
||||
where \( d=2 \) in our case and \( \boldsymbol{x}_i=[x_i,y_i] \) and \( \boldsymbol{x}_j=[x_j,y_j] \).
|
||||
To compute the last equation is however inefficient from a computational stand.
|
||||
Instead of computing the last equation for the kernel, we simply compute
|
||||
the dot product \( (\boldsymbol{x}_i^T\boldsymbol{x}_j)^2 \).
|
||||
@@ -809,13 +809,10 @@ $$
|
||||
<ol>
|
||||
<p><li> With a given kernel we can thus define the matrix \( \boldsymbol{P} \).</li>
|
||||
<p><li> The matrix \( \boldsymbol{P} \) has matrix elements \( p_{ij}=y_iy_jK(\boldsymbol{x}_i,\boldsymbol{x}_j) \). Given a kernel \( K \) and the targets \( y_i \) this matrix is easy to set up.</li>
|
||||
<p><li> The \( \boldsymbol{q} \) is zero.</li>
|
||||
<p><li> The vector \( \boldsymbol{q} \) is zero.</li>
|
||||
<p><li> The constraint \( \boldsymbol{y}^T\boldsymbol{\lambda}=0 \) leads to \( f=0 \) and \( \boldsymbol{A}=\boldsymbol{y} \).</li>
|
||||
<p><li> To set up the matrix \( \boldsymbol{G} \) we note that the inequalities \( 0\leq \lambda_i \leq C \) can be split up into</li>
|
||||
<p><li> To set up the matrix \( \boldsymbol{G} \) we note that the inequalities \( 0\leq \lambda_i \leq C \) can be split up into \( 0\leq \lambda_i \) and \( \lambda_i \leq C \). These two inequalities define then the matrix \( \boldsymbol{G} \) and the vector \( \boldsymbol{h} \).</li>
|
||||
</ol>
|
||||
<p>
|
||||
|
||||
\( 0\leq \lambda_i \) and \( \lambda_i \leq C \). These two inequalities define then the matrix \( \boldsymbol{G} \) and the vector \( \boldsymbol{h} \).
|
||||
</section>
|
||||
|
||||
|
||||
@@ -833,18 +830,18 @@ $$
|
||||
0& 0 & -1 & \dots & 0 \\
|
||||
\dots& \dots & \dots & \dots & \dots \\
|
||||
0& 0 & 0 & \dots & -1 \\
|
||||
-& 0 & 0 & \dots & 0 \\
|
||||
1 & 0 & 0 & \dots & 0 \\
|
||||
0& 1 & 0 & \dots & 0 \\
|
||||
0& 0 & 1 & \dots & 0 \\
|
||||
\dots& \dots & \dots & \dots & \dots \\
|
||||
0& 0 & 0 & \dots & 1 \\
|
||||
\end{bmatrix}\boldsymbol{\lambda}
|
||||
\end{bmatrix}
|
||||
\begin{bmatrix} \lambda_1 \\
|
||||
\lambda_2 \\
|
||||
\lambda_3 \\
|
||||
\dots \\
|
||||
\lambda_n \\
|
||||
\end{bmatrix}\boldsymbol{\lambda}=
|
||||
\end{bmatrix}=
|
||||
\begin{bmatrix} 0 \\
|
||||
0 \\
|
||||
0 \\
|
||||
@@ -855,7 +852,7 @@ C \\
|
||||
C \\
|
||||
\dots \\
|
||||
C \\
|
||||
\end{bmatrix}\boldsymbol{\lambda}
|
||||
\end{bmatrix}.
|
||||
$$
|
||||
<p> <br>
|
||||
|
||||
|
||||
@@ -342,9 +342,9 @@ plt.show()
|
||||
<h2 id="___sec5">The equations </h2>
|
||||
|
||||
<p>
|
||||
Suppose we define a polynomial transformation of degree two only (we continue to live in a plane with \( x_i \) and \( y_i \) as variables)
|
||||
Suppose we define a polynomial transformation of degree two only (we continue to live in a plane with \( x_i \) and \( y_i \) as variables). We define a vector \( \boldsymbol{x}_i=[x_i,y_i] \) and have
|
||||
$$
|
||||
z = \phi(x_i) =\left(1, \sqrt{2}x_i, \sqrt{2}y_i, x_i^2, y_i^2, \sqrt{2}x_iy_i\right).
|
||||
\boldsymbol{z}_i = \phi(\boldsymbol{x}_i)^T =\left(1, \sqrt{2}x_i, \sqrt{2}y_i, x_i^2, y_i^2, \sqrt{2}x_iy_i\right).
|
||||
$$
|
||||
|
||||
<p>
|
||||
@@ -372,10 +372,10 @@ $$
|
||||
<p>
|
||||
We note that this dot product can be rewritten as
|
||||
$$
|
||||
K(\boldsymbol{x}_i,\boldsymbol{x}_j)=[1+\boldsymbol{x}^T\boldsymbol{x}']^d,
|
||||
K(\boldsymbol{x}_i,\boldsymbol{x}_j)=[1+\boldsymbol{x}_i^T\boldsymbol{x}_j]^d,
|
||||
$$
|
||||
|
||||
where \( d=2 \) in our case and \( \boldsymbol{x}=[x_i,y_i] \) and \( \boldsymbol{x}=[x_j,y_j] \).
|
||||
where \( d=2 \) in our case and \( \boldsymbol{x}_i=[x_i,y_i] \) and \( \boldsymbol{x}_j=[x_j,y_j] \).
|
||||
To compute the last equation is however inefficient from a computational stand.
|
||||
Instead of computing the last equation for the kernel, we simply compute
|
||||
the dot product \( (\boldsymbol{x}_i^T\boldsymbol{x}_j)^2 \).
|
||||
@@ -816,14 +816,11 @@ $$
|
||||
<ol>
|
||||
<li> With a given kernel we can thus define the matrix \( \boldsymbol{P} \).</li>
|
||||
<li> The matrix \( \boldsymbol{P} \) has matrix elements \( p_{ij}=y_iy_jK(\boldsymbol{x}_i,\boldsymbol{x}_j) \). Given a kernel \( K \) and the targets \( y_i \) this matrix is easy to set up.</li>
|
||||
<li> The \( \boldsymbol{q} \) is zero.</li>
|
||||
<li> The vector \( \boldsymbol{q} \) is zero.</li>
|
||||
<li> The constraint \( \boldsymbol{y}^T\boldsymbol{\lambda}=0 \) leads to \( f=0 \) and \( \boldsymbol{A}=\boldsymbol{y} \).</li>
|
||||
<li> To set up the matrix \( \boldsymbol{G} \) we note that the inequalities \( 0\leq \lambda_i \leq C \) can be split up into</li>
|
||||
<li> To set up the matrix \( \boldsymbol{G} \) we note that the inequalities \( 0\leq \lambda_i \leq C \) can be split up into \( 0\leq \lambda_i \) and \( \lambda_i \leq C \). These two inequalities define then the matrix \( \boldsymbol{G} \) and the vector \( \boldsymbol{h} \).</li>
|
||||
</ol>
|
||||
|
||||
\( 0\leq \lambda_i \) and \( \lambda_i \leq C \). These two inequalities define then the matrix \( \boldsymbol{G} \) and the vector \( \boldsymbol{h} \).
|
||||
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
|
||||
<h2 id="___sec15">Setting up \( \boldsymbol{G}\boldsymbol{\lambda} \preceq \boldsymbol{h} \) </h2>
|
||||
@@ -838,18 +835,18 @@ $$
|
||||
0& 0 & -1 & \dots & 0 \\
|
||||
\dots& \dots & \dots & \dots & \dots \\
|
||||
0& 0 & 0 & \dots & -1 \\
|
||||
-& 0 & 0 & \dots & 0 \\
|
||||
1 & 0 & 0 & \dots & 0 \\
|
||||
0& 1 & 0 & \dots & 0 \\
|
||||
0& 0 & 1 & \dots & 0 \\
|
||||
\dots& \dots & \dots & \dots & \dots \\
|
||||
0& 0 & 0 & \dots & 1 \\
|
||||
\end{bmatrix}\boldsymbol{\lambda}
|
||||
\end{bmatrix}
|
||||
\begin{bmatrix} \lambda_1 \\
|
||||
\lambda_2 \\
|
||||
\lambda_3 \\
|
||||
\dots \\
|
||||
\lambda_n \\
|
||||
\end{bmatrix}\boldsymbol{\lambda}=
|
||||
\end{bmatrix}=
|
||||
\begin{bmatrix} 0 \\
|
||||
0 \\
|
||||
0 \\
|
||||
@@ -860,7 +857,7 @@ C \\
|
||||
C \\
|
||||
\dots \\
|
||||
C \\
|
||||
\end{bmatrix}\boldsymbol{\lambda}
|
||||
\end{bmatrix}.
|
||||
$$
|
||||
|
||||
<p>
|
||||
|
||||
@@ -347,9 +347,9 @@ plt<span style="color: #666666">.</span>show()
|
||||
<h2 id="___sec5">The equations </h2>
|
||||
|
||||
<p>
|
||||
Suppose we define a polynomial transformation of degree two only (we continue to live in a plane with \( x_i \) and \( y_i \) as variables)
|
||||
Suppose we define a polynomial transformation of degree two only (we continue to live in a plane with \( x_i \) and \( y_i \) as variables). We define a vector \( \boldsymbol{x}_i=[x_i,y_i] \) and have
|
||||
$$
|
||||
z = \phi(x_i) =\left(1, \sqrt{2}x_i, \sqrt{2}y_i, x_i^2, y_i^2, \sqrt{2}x_iy_i\right).
|
||||
\boldsymbol{z}_i = \phi(\boldsymbol{x}_i)^T =\left(1, \sqrt{2}x_i, \sqrt{2}y_i, x_i^2, y_i^2, \sqrt{2}x_iy_i\right).
|
||||
$$
|
||||
|
||||
<p>
|
||||
@@ -377,10 +377,10 @@ $$
|
||||
<p>
|
||||
We note that this dot product can be rewritten as
|
||||
$$
|
||||
K(\boldsymbol{x}_i,\boldsymbol{x}_j)=[1+\boldsymbol{x}^T\boldsymbol{x}']^d,
|
||||
K(\boldsymbol{x}_i,\boldsymbol{x}_j)=[1+\boldsymbol{x}_i^T\boldsymbol{x}_j]^d,
|
||||
$$
|
||||
|
||||
where \( d=2 \) in our case and \( \boldsymbol{x}=[x_i,y_i] \) and \( \boldsymbol{x}=[x_j,y_j] \).
|
||||
where \( d=2 \) in our case and \( \boldsymbol{x}_i=[x_i,y_i] \) and \( \boldsymbol{x}_j=[x_j,y_j] \).
|
||||
To compute the last equation is however inefficient from a computational stand.
|
||||
Instead of computing the last equation for the kernel, we simply compute
|
||||
the dot product \( (\boldsymbol{x}_i^T\boldsymbol{x}_j)^2 \).
|
||||
@@ -821,14 +821,11 @@ $$
|
||||
<ol>
|
||||
<li> With a given kernel we can thus define the matrix \( \boldsymbol{P} \).</li>
|
||||
<li> The matrix \( \boldsymbol{P} \) has matrix elements \( p_{ij}=y_iy_jK(\boldsymbol{x}_i,\boldsymbol{x}_j) \). Given a kernel \( K \) and the targets \( y_i \) this matrix is easy to set up.</li>
|
||||
<li> The \( \boldsymbol{q} \) is zero.</li>
|
||||
<li> The vector \( \boldsymbol{q} \) is zero.</li>
|
||||
<li> The constraint \( \boldsymbol{y}^T\boldsymbol{\lambda}=0 \) leads to \( f=0 \) and \( \boldsymbol{A}=\boldsymbol{y} \).</li>
|
||||
<li> To set up the matrix \( \boldsymbol{G} \) we note that the inequalities \( 0\leq \lambda_i \leq C \) can be split up into</li>
|
||||
<li> To set up the matrix \( \boldsymbol{G} \) we note that the inequalities \( 0\leq \lambda_i \leq C \) can be split up into \( 0\leq \lambda_i \) and \( \lambda_i \leq C \). These two inequalities define then the matrix \( \boldsymbol{G} \) and the vector \( \boldsymbol{h} \).</li>
|
||||
</ol>
|
||||
|
||||
\( 0\leq \lambda_i \) and \( \lambda_i \leq C \). These two inequalities define then the matrix \( \boldsymbol{G} \) and the vector \( \boldsymbol{h} \).
|
||||
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
|
||||
<h2 id="___sec15">Setting up \( \boldsymbol{G}\boldsymbol{\lambda} \preceq \boldsymbol{h} \) </h2>
|
||||
@@ -843,18 +840,18 @@ $$
|
||||
0& 0 & -1 & \dots & 0 \\
|
||||
\dots& \dots & \dots & \dots & \dots \\
|
||||
0& 0 & 0 & \dots & -1 \\
|
||||
-& 0 & 0 & \dots & 0 \\
|
||||
1 & 0 & 0 & \dots & 0 \\
|
||||
0& 1 & 0 & \dots & 0 \\
|
||||
0& 0 & 1 & \dots & 0 \\
|
||||
\dots& \dots & \dots & \dots & \dots \\
|
||||
0& 0 & 0 & \dots & 1 \\
|
||||
\end{bmatrix}\boldsymbol{\lambda}
|
||||
\end{bmatrix}
|
||||
\begin{bmatrix} \lambda_1 \\
|
||||
\lambda_2 \\
|
||||
\lambda_3 \\
|
||||
\dots \\
|
||||
\lambda_n \\
|
||||
\end{bmatrix}\boldsymbol{\lambda}=
|
||||
\end{bmatrix}=
|
||||
\begin{bmatrix} 0 \\
|
||||
0 \\
|
||||
0 \\
|
||||
@@ -865,7 +862,7 @@ C \\
|
||||
C \\
|
||||
\dots \\
|
||||
C \\
|
||||
\end{bmatrix}\boldsymbol{\lambda}
|
||||
\end{bmatrix}.
|
||||
$$
|
||||
|
||||
<p>
|
||||
|
||||
Binary file not shown.
@@ -138,7 +138,7 @@
|
||||
"source": [
|
||||
"## The equations\n",
|
||||
"\n",
|
||||
"Suppose we define a polynomial transformation of degree two only (we continue to live in a plane with $x_i$ and $y_i$ as variables)"
|
||||
"Suppose we define a polynomial transformation of degree two only (we continue to live in a plane with $x_i$ and $y_i$ as variables). We define a vector $\\boldsymbol{x}_i=[x_i,y_i]$ and have"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -146,7 +146,7 @@
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"$$\n",
|
||||
"z = \\phi(x_i) =\\left(1, \\sqrt{2}x_i, \\sqrt{2}y_i, x_i^2, y_i^2, \\sqrt{2}x_iy_i\\right).\n",
|
||||
"\\boldsymbol{z}_i = \\phi(\\boldsymbol{x}_i)^T =\\left(1, \\sqrt{2}x_i, \\sqrt{2}y_i, x_i^2, y_i^2, \\sqrt{2}x_iy_i\\right).\n",
|
||||
"$$"
|
||||
]
|
||||
},
|
||||
@@ -227,7 +227,7 @@
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"$$\n",
|
||||
"K(\\boldsymbol{x}_i,\\boldsymbol{x}_j)=[1+\\boldsymbol{x}^T\\boldsymbol{x}']^d,\n",
|
||||
"K(\\boldsymbol{x}_i,\\boldsymbol{x}_j)=[1+\\boldsymbol{x}_i^T\\boldsymbol{x}_j]^d,\n",
|
||||
"$$"
|
||||
]
|
||||
},
|
||||
@@ -235,7 +235,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"where $d=2$ in our case and $\\boldsymbol{x}=[x_i,y_i]$ and $\\boldsymbol{x}=[x_j,y_j]$.\n",
|
||||
"where $d=2$ in our case and $\\boldsymbol{x}_i=[x_i,y_i]$ and $\\boldsymbol{x}_j=[x_j,y_j]$.\n",
|
||||
"To compute the last equation is however inefficient from a computational stand.\n",
|
||||
"Instead of computing the last equation for the kernel, we simply compute\n",
|
||||
"the dot product $(\\boldsymbol{x}_i^T\\boldsymbol{x}_j)^2$.\n",
|
||||
@@ -815,13 +815,11 @@
|
||||
"\n",
|
||||
"2. The matrix $\\boldsymbol{P}$ has matrix elements $p_{ij}=y_iy_jK(\\boldsymbol{x}_i,\\boldsymbol{x}_j)$. Given a kernel $K$ and the targets $y_i$ this matrix is easy to set up.\n",
|
||||
"\n",
|
||||
"3. The $\\boldsymbol{q}$ is zero.\n",
|
||||
"3. The vector $\\boldsymbol{q}$ is zero.\n",
|
||||
"\n",
|
||||
"4. The constraint $\\boldsymbol{y}^T\\boldsymbol{\\lambda}=0$ leads to $f=0$ and $\\boldsymbol{A}=\\boldsymbol{y}$.\n",
|
||||
"\n",
|
||||
"5. To set up the matrix $\\boldsymbol{G}$ we note that the inequalities $0\\leq \\lambda_i \\leq C$ can be split up into\n",
|
||||
"\n",
|
||||
"$0\\leq \\lambda_i$ and $\\lambda_i \\leq C$. These two inequalities define then the matrix $\\boldsymbol{G}$ and the vector $\\boldsymbol{h}$.\n",
|
||||
"5. To set up the matrix $\\boldsymbol{G}$ we note that the inequalities $0\\leq \\lambda_i \\leq C$ can be split up into $0\\leq \\lambda_i$ and $\\lambda_i \\leq C$. These two inequalities define then the matrix $\\boldsymbol{G}$ and the vector $\\boldsymbol{h}$.\n",
|
||||
"\n",
|
||||
"## Setting up $\\boldsymbol{G}\\boldsymbol{\\lambda} \\preceq \\boldsymbol{h}$\n",
|
||||
"\n",
|
||||
@@ -840,18 +838,18 @@
|
||||
"0& 0 & -1 & \\dots & 0 \\\\\n",
|
||||
"\\dots& \\dots & \\dots & \\dots & \\dots \\\\\n",
|
||||
"0& 0 & 0 & \\dots & -1 \\\\\n",
|
||||
" -& 0 & 0 & \\dots & 0 \\\\\n",
|
||||
"1 & 0 & 0 & \\dots & 0 \\\\\n",
|
||||
"0& 1 & 0 & \\dots & 0 \\\\\n",
|
||||
"0& 0 & 1 & \\dots & 0 \\\\\n",
|
||||
"\\dots& \\dots & \\dots & \\dots & \\dots \\\\\n",
|
||||
"0& 0 & 0 & \\dots & 1 \\\\\n",
|
||||
"\\end{bmatrix}\\boldsymbol{\\lambda}\n",
|
||||
"\\end{bmatrix}\n",
|
||||
"\\begin{bmatrix} \\lambda_1 \\\\\n",
|
||||
"\\lambda_2 \\\\\n",
|
||||
"\\lambda_3 \\\\\n",
|
||||
"\\dots \\\\\n",
|
||||
"\\lambda_n \\\\\n",
|
||||
"\\end{bmatrix}\\boldsymbol{\\lambda}=\n",
|
||||
"\\end{bmatrix}=\n",
|
||||
"\\begin{bmatrix} 0 \\\\\n",
|
||||
"0 \\\\\n",
|
||||
"0 \\\\\n",
|
||||
@@ -862,7 +860,7 @@
|
||||
"C \\\\\n",
|
||||
"\\dots \\\\\n",
|
||||
"C \\\\\n",
|
||||
"\\end{bmatrix}\\boldsymbol{\\lambda}\n",
|
||||
"\\end{bmatrix}.\n",
|
||||
"$$"
|
||||
]
|
||||
},
|
||||
|
||||
@@ -119,10 +119,10 @@ plt.show()
|
||||
!split
|
||||
===== The equations =====
|
||||
|
||||
Suppose we define a polynomial transformation of degree two only (we continue to live in a plane with $x_i$ and $y_i$ as variables)
|
||||
Suppose we define a polynomial transformation of degree two only (we continue to live in a plane with $x_i$ and $y_i$ as variables). We define a vector $\bm{x}_i=[x_i,y_i]$ and have
|
||||
!bt
|
||||
\[
|
||||
z = \phi(x_i) =\left(1, \sqrt{2}x_i, \sqrt{2}y_i, x_i^2, y_i^2, \sqrt{2}x_iy_i\right).
|
||||
\bm{z}_i = \phi(\bm{x}_i)^T =\left(1, \sqrt{2}x_i, \sqrt{2}y_i, x_i^2, y_i^2, \sqrt{2}x_iy_i\right).
|
||||
\]
|
||||
!et
|
||||
|
||||
@@ -155,10 +155,10 @@ K(\bm{x}_i,\bm{x}_j)=[1, \sqrt{2}x_i, \sqrt{2}y_i, x_i^2, y_i^2, \sqrt{2}x_iy_i]
|
||||
We note that this dot product can be rewritten as
|
||||
!bt
|
||||
\[
|
||||
K(\bm{x}_i,\bm{x}_j)=[1+\bm{x}^T\bm{x}']^d,
|
||||
K(\bm{x}_i,\bm{x}_j)=[1+\bm{x}_i^T\bm{x}_j]^d,
|
||||
\]
|
||||
!et
|
||||
where $d=2$ in our case and $\bm{x}=[x_i,y_i]$ and $\bm{x}=[x_j,y_j]$.
|
||||
where $d=2$ in our case and $\bm{x}_i=[x_i,y_i]$ and $\bm{x}_j=[x_j,y_j]$.
|
||||
To compute the last equation is however inefficient from a computational stand.
|
||||
Instead of computing the last equation for the kernel, we simply compute
|
||||
the dot product $(\bm{x}_i^T\bm{x}_j)^2$.
|
||||
@@ -574,10 +574,9 @@ We have the general problem
|
||||
|
||||
o With a given kernel we can thus define the matrix $\bm{P}$.
|
||||
o The matrix $\bm{P}$ has matrix elements $p_{ij}=y_iy_jK(\bm{x}_i,\bm{x}_j)$. Given a kernel $K$ and the targets $y_i$ this matrix is easy to set up.
|
||||
o The $\bm{q}$ is zero.
|
||||
o The vector $\bm{q}$ is zero.
|
||||
o The constraint $\bm{y}^T\bm{\lambda}=0$ leads to $f=0$ and $\bm{A}=\bm{y}$.
|
||||
o To set up the matrix $\bm{G}$ we note that the inequalities $0\leq \lambda_i \leq C$ can be split up into
|
||||
$0\leq \lambda_i$ and $\lambda_i \leq C$. These two inequalities define then the matrix $\bm{G}$ and the vector $\bm{h}$.
|
||||
o To set up the matrix $\bm{G}$ we note that the inequalities $0\leq \lambda_i \leq C$ can be split up into $0\leq \lambda_i$ and $\lambda_i \leq C$. These two inequalities define then the matrix $\bm{G}$ and the vector $\bm{h}$.
|
||||
|
||||
!split
|
||||
===== Setting up $\bm{G}\bm{\lambda} \preceq \bm{h}$ =====
|
||||
@@ -592,18 +591,18 @@ can be written as
|
||||
0& 0 & -1 & \dots & 0 \\
|
||||
\dots& \dots & \dots & \dots & \dots \\
|
||||
0& 0 & 0 & \dots & -1 \\
|
||||
-& 0 & 0 & \dots & 0 \\
|
||||
1 & 0 & 0 & \dots & 0 \\
|
||||
0& 1 & 0 & \dots & 0 \\
|
||||
0& 0 & 1 & \dots & 0 \\
|
||||
\dots& \dots & \dots & \dots & \dots \\
|
||||
0& 0 & 0 & \dots & 1 \\
|
||||
\end{bmatrix}\bm{\lambda}
|
||||
\end{bmatrix}
|
||||
\begin{bmatrix} \lambda_1 \\
|
||||
\lambda_2 \\
|
||||
\lambda_3 \\
|
||||
\dots \\
|
||||
\lambda_n \\
|
||||
\end{bmatrix}\bm{\lambda}=
|
||||
\end{bmatrix}=
|
||||
\begin{bmatrix} 0 \\
|
||||
0 \\
|
||||
0 \\
|
||||
@@ -614,7 +613,7 @@ C \\
|
||||
C \\
|
||||
\dots \\
|
||||
C \\
|
||||
\end{bmatrix}\bm{\lambda}
|
||||
\end{bmatrix}.
|
||||
\]
|
||||
!et
|
||||
|
||||
|
||||
Reference in New Issue
Block a user