Skip to content

Commit ab7dbe2

Browse files
authored
Merge pull request #48 from kashefy/kpca_lin
demonstrate linear combination
2 parents a9fb516 + db19811 commit ab7dbe2

File tree

3 files changed

+43
-22
lines changed

3 files changed

+43
-22
lines changed

.travis.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
sudo: required
2-
#dist: trusty
3-
#language: r
1+
os: linux
2+
dist: bionic
3+
language: ruby
44
before_install:
5-
- sudo apt-get -qq update && sudo apt-get install -qq -y --no-install-recommends texlive-fonts-recommended texlive-latex-extra texlive-fonts-extra dvipng texlive-latex-recommended latex-beamer texlive-science
5+
- sudo apt-get -qq update && sudo apt-get install -qq -y --no-install-recommends texlive-fonts-recommended texlive-latex-extra texlive-fonts-extra dvipng texlive-latex-recommended texlive-science
66
#- tlmgr install index
77
#- sudo tlmgr init-usertree
88
#- tlmgr install --reinstall --repository https://www.komascript.de/repository/texlive/2020 koma-script\
@@ -13,13 +13,12 @@ after_success:
1313
- bash .ci/travis/zip_pdfs.sh
1414
deploy:
1515
provider: releases
16-
api_key: "$GITHU8_API_KEY"
16+
token: "$GITHU8_API_KEY"
1717
file_glob: true
1818
file:
1919
- "./notes/**/tutorial_*.slides.pdf"
2020
- "./notes/**/tutorial_*.notes.pdf"
2121
- "./tutorial_*.zip"
22-
skip_cleanup: true
2322
on:
2423
branch: master
2524
# edge: true

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Topics covered throughout the course:
1717
* Self-Organizing Maps
1818
* Locally Linear Embedding
1919
* Probability density estimation
20-
* Mixture models & Expectation-Maximization algorithm
20+
* Mixture models & the Expectation-Maximization algorithm
2121
* Hidden Markov Models
2222
* Estimation theory
2323

notes/03_kernel-pca/3_kpca.tex

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ \subsubsection{Centering the immediate input to PCA}
9191
Remember, we will first assume that we have the non-linear mapping $\phi$.\\
9292

9393
PCA assumes its input is centered.
94-
It's direct input are the $\phi$'s. Therefore,
94+
Its direct input are the $\phi$'s. Therefore,
9595
\begin{equation}
9696
\frac{1}{p} \sum^{p}_{\alpha=1} \vec{\phi}_{(\vec{x}^{(\alpha)})} \eqexcl \vec 0
9797
\end{equation}
@@ -156,13 +156,35 @@ \subsubsection{The eigenvalue problem}
156156
\vec{\phi}^{(\beta)}
157157
\end{equation}
158158

159-
\notesonly{
160-
Eq.\ref{eq:ephi} tells us that we can describe $\vec e$ in terms of the transformed observations (a weighted summation of $\phi$'s).
159+
\end{frame}
160+
161+
\mode<article>{
162+
163+
It is possible to arrive at the linear relationship in \eqref{eq:ephi} by substituting \eqref{eq:cov} into the eigenvalue problem in \eqref{eq:eig}:
164+
165+
\begin{align}
166+
\underbrace{\frac{1}{p} \sum_{\alpha=1}^{p} \vec{\phi}^{(\alpha)} {\color{blue}\big(\vec{\phi}^{(\alpha)}\big)^\top}
167+
}_{=\,\vec C_{\phi}}
168+
\,
169+
{\color{blue}\vec e}
170+
= \lambda \;\, \vec e\\
171+
\intertext{with ${\color{blue}\big(\vec{\phi}^{(\alpha)}\big)^\top \vec e = \vec e^\top\vec{\phi}^{(\alpha)}}$ measuring the scalar projection $u_{(\vec{\phi}^{(\alpha)})}$ along $\vec e$:}
172+
\frac{1}{p} \sum_{\alpha=1}^{p} u_{(\vec{\phi}^{(\alpha)})} \vec{\phi}^{(\alpha)}
173+
= \lambda \;\, \vec e\\
174+
\vec e =
175+
\frac{1}{p} \sum_{\alpha=1}^{p} \frac{u_{(\vec{\phi}^{(\alpha)})}}{\lambda} \vec{\phi}^{(\alpha)}\\
176+
\intertext{This effectivley expresses $\vec e$ as a linear combination of the transformed observations:}
177+
\vec e =
178+
\frac{1}{p} \sum_{\alpha=1}^{p} a^{(\alpha)} \vec{\phi}^{(\alpha)} \stackrel{\substack{\text{switch index}\\{\alpha \rightarrow \beta}}}{=} \frac{1}{p} \sum_{\beta=1}^{p} a^{(\beta)} \vec{\phi}^{(\beta)}
179+
\end{align}
180+
181+
\paragraph{Deriving the transformed eigenvalue problem}
182+
183+
\eqref{eq:ephi} tells us that we can describe $\vec e$ in terms of the transformed observations (a weighted summation of $\phi$'s).
161184
The use of the index $\beta$ is only to avoid collisions with $\alpha$ later.
185+
162186
}
163187

164-
\end{frame}
165-
166188
\begin{frame}{\subsubsecname}
167189

168190
\slidesonly{
@@ -184,7 +206,7 @@ \subsubsection{The eigenvalue problem}
184206
}
185207

186208
\notesonly{
187-
Substituting Eq.\ref{eq:cov} and Eq.\ref{eq:ephi} into the eigenvalue problem Eq.\ref{eq:eig}:
209+
Substituting \eqref{eq:cov} and \eqref{eq:ephi} into the eigenvalue problem \eqref{eq:eig}:
188210
}
189211
\slidesonly{
190212
Express the eigenvalue problem in terms of $\phi$'s:
@@ -243,15 +265,15 @@ \subsubsection{The eigenvalue problem}
243265
}
244266

245267
\notesonly{
246-
Recall from \sectionref{sec:nonlin} that we are not even able to compute $\vec{\phi}_{(\vec{x})}$ but we now see it is possible to avoid the transformation altogether by exploiting the kernel trick (cf. Eq.\ref{eq:trick}) by substituting
268+
Recall from \sectionref{sec:nonlin} that we are not even able to compute $\vec{\phi}_{(\vec{x})}$ but we now see it is possible to avoid the transformation altogether by exploiting the kernel trick (cf. \eqref{eq:trick}) by substituting
247269
$ K_{\alpha \beta} $ for
248270
$
249271
\vec{\phi}^{\top}_{(\vec{x}^{(\alpha)})}
250272
\,
251273
\vec{\phi}_{(\vec{x}^{(\beta)})}
252274
$
253275

254-
Eq.\ref{eq:eig2} becomes:}
276+
\eqref{eq:eig2} becomes:}
255277

256278
\begin{equation} \label{eq:eig3}
257279
\frac{1}{p} \sum_{\alpha=1}^{p} \sum^{p}_{\beta=1}
@@ -267,7 +289,7 @@ \subsubsection{The eigenvalue problem}
267289

268290
\pause
269291

270-
\notesonly{We }left-multiply\notesonly{ Eq.\ref{eq:eig3}} with $\big(\vec \phi_{(\vec x^{(\gamma)})}\big)^\top$, where $\gamma = 1, \ldots, p$.
292+
\notesonly{We }left-multiply\notesonly{ \eqref{eq:eig3}} with $\big(\vec \phi_{(\vec x^{(\gamma)})}\big)^\top$, where $\gamma = 1, \ldots, p$.
271293
We can pull $\big(\vec \phi^{(\gamma)}\big)^\top$ directly into the sum on the \slidesonly{LHS}\notesonly{left-hand-side} and the sum on the \slidesonly{RHS}\notesonly{right-hand-side}:
272294

273295
\only<2,3>{
@@ -289,7 +311,7 @@ \subsubsection{The eigenvalue problem}
289311

290312
\pause
291313

292-
\newpage
314+
%\newpage
293315

294316
\notesonly{\eqref{eq:eig4} without the clutter:}
295317

@@ -592,13 +614,13 @@ \subsubsection{Normalize the eigenvectors}
592614

593615
\begin{frame}{\subsubsecname}
594616

595-
Recall\notesonly{ing Eq.\ref{eq:ephi} (we add the index $k$ to denote which eigenvector):}
617+
Recall\notesonly{ing \eqref{eq:ephi} (we add the index $k$ to denote which eigenvector):}
596618
\begin{equation}
597619
\label{eq:ephik}
598620
\vec e_k = \sum^{p}_{\beta=1} a_k^{(\beta)} \vec{\phi}_{(\vec{x}^{(\beta)})},
599621
\end{equation}
600622

601-
We want an expression for the norm $\vec e^{\top}_k \vec e_k$ that does not involve $\phi$'s. We left-multiply\slidesonly{ the above}\notesonly{ Eq.\ref{eq:ephik}} with $\left(\vec e_k\right)^\top$:
623+
We want an expression for the norm $\vec e^{\top}_k \vec e_k$ that does not involve $\phi$'s. We left-multiply\slidesonly{ the above}\notesonly{ \eqref{eq:ephik}} with $\left(\vec e_k\right)^\top$:
602624
\begin{align}
603625
\vec e^{\top}_k \vec e_k &= \sum^{p}_{\alpha=1} a_k^{(\alpha)} \vec{\phi}_{(\vec{x}^{(\alpha)})}^\top \sum^{p}_{\beta=1} a_k^{(\beta)} \vec{\phi}_{(\vec{x}^{(\beta)})} \\
604626
&= \sum^{p}_{\alpha=1} \sum^{p}_{\beta=1} a_k^{(\beta)} \underbrace{\vec{\phi}_{(\vec{x}^{(\alpha)})}^\top \vec{\phi}_{(\vec{x}^{(\beta)})}} a_k^{(\alpha)} \\
@@ -611,7 +633,7 @@ \subsubsection{Normalize the eigenvectors}
611633
\begin{frame}{\subsubsecname}
612634

613635
\notesonly{
614-
And when we plug Eq.\ref{eq:eigsimple1} into the above:
636+
And when we plug \eqref{eq:eigsimple1} into the above:
615637
}
616638
\slidesonly{
617639
From $\vec{K} \, \widetilde {\vec a}_k = p \lambda \widetilde {\vec a}_k$ follows:
@@ -641,7 +663,7 @@ \subsubsection{Normalize the eigenvectors}
641663

642664
\notesonly{
643665
Scaling $\widetilde {\vec a}_k$ by $\frac{1}{\sqrt{p \lambda_k}}$ yields
644-
a vector in the same direction as $\widetilde {\vec a}_k$ to satisfy \notesonly{Eq.\ref{eq:eignorm}}\slidesonly{$\vec e^{\top}_k \vec e_k \eqexcl 1$}.\\
666+
a vector in the same direction as $\widetilde {\vec a}_k$ to satisfy \notesonly{\eqref{eq:eignorm}}\slidesonly{$\vec e^{\top}_k \vec e_k \eqexcl 1$}.\\
645667
}
646668
With
647669
\svspace{-5mm}
@@ -737,7 +759,7 @@ \subsubsection{Projection}
737759
\pause
738760

739761
\notesonly{
740-
We substitute $\vec \phi_{(\vec x)}$ for $\vec x$ and plug Eq.\ref{eq:ephi} into Eq.\ref{eq:projlin}:
762+
We substitute $\vec \phi_{(\vec x)}$ for $\vec x$ and plug \eqref{eq:ephi} into \eqref{eq:projlin}:
741763
}
742764

743765
\visible<3>{

0 commit comments

Comments
 (0)