forked from TH_General/Template_Summary
Latent Variable Models and Variational Bayes hinzugefügt.
This commit is contained in:
parent
601e20cf68
commit
44c81306a8
25
Glossary.tex
25
Glossary.tex
@ -7,6 +7,16 @@
|
||||
\shorthandon{"}
|
||||
% {{{ Main glossary%
|
||||
|
||||
\newglossaryentry{manifold}{
|
||||
name=Mannigfaltigkeit,
|
||||
description={
|
||||
\say{Unter einer Mannigfaltigkeit versteht man in der Mathematik einen topologischen Raum,
|
||||
der lokal dem euklidischen Raum $\mathbb{R}^n$ gleicht.
|
||||
Global muss die Mannigfaltigkeit jedoch nicht einem euklidischen Raum gleichen (nicht zu ihm homöomorph sein).
|
||||
}(\url{https://de.wikipedia.org/wiki/Mannigfaltigkeit})
|
||||
}
|
||||
}
|
||||
|
||||
\newglossaryentry{overfitting}{
|
||||
name=Overfitting,
|
||||
description={
|
||||
@ -90,22 +100,9 @@
|
||||
% }}} %
|
||||
|
||||
% {{{ acronyms%
|
||||
% {{{ acronym makros %
|
||||
\newcommand{\glstopfull}[1]{\texorpdfstring{\glsxtrfull{#1}}{\glsfmtfull{#1}}}
|
||||
\newcommand{\Glstopfull}[1]{\texorpdfstring{\Glsxtrfull{#1}}{\Glsfmtfull{#1}}}
|
||||
\newcommand{\glstopfullpl}[1]{\texorpdfstring{\glsxtrfullpl{#1}}{\glsfmtfullpl{#1}}}
|
||||
\newcommand{\Glstopfullpl}[1]{\texorpdfstring{\Glsxtrfullpl{#1}}{\Glsfmtfullpl{#1}}}
|
||||
\newcommand{\glstopshort}[1]{\texorpdfstring{\glsxtrshort{#1}}{\glsfmtshort{#1}}}
|
||||
\newcommand{\Glstopshort}[1]{\texorpdfstring{\Glsxtrshort{#1}}{\Glsfmtshort{#1}}}
|
||||
\newcommand{\glstopshortpl}[1]{\texorpdfstring{\glsxtrshortpl{#1}}{\glsfmtshortpl{#1}}}
|
||||
\newcommand{\Glstopshortpl}[1]{\texorpdfstring{\Glsxtrshortpl{#1}}{\Glsfmtshortpl{#1}}}
|
||||
\newcommand{\glstoplong}[1]{\texorpdfstring{\glsxtrlong{#1}}{\glsfmtlong{#1}}}
|
||||
\newcommand{\Glstoplong}[1]{\texorpdfstring{\Glsxtrlong{#1}}{\Glsfmtlong{#1}}}
|
||||
\newcommand{\glstoplongpl}[1]{\texorpdfstring{\glsxtrlongpl{#1}}{\glsfmtlongpl{#1}}}
|
||||
\newcommand{\Glstoplongpl}[1]{\texorpdfstring{\Glsxtrlongpl{#1}}{\Glsfmtlongpl{#1}}}
|
||||
% }}} %
|
||||
\setabbreviationstyle[acronym]{long-short}
|
||||
|
||||
\newacronym{VAE}{VAE}{Variational Auto-Encoder}
|
||||
\newacronym{KL}{KL}{Kullback-Leibler}
|
||||
\newacronym{EM}{EM}{Expectation Maximization}
|
||||
\newacronym{PCA}{PCA}{Principal Component Analysis}
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
\input{Packages.tex}
|
||||
\input{Style.tex}
|
||||
\input{Makros.tex}
|
||||
|
||||
\def \AUTHOR{Paul Lödige}
|
||||
\def \AUTHOREMAIL{paul.loedige@student.kit.edu}
|
||||
@ -43,7 +44,8 @@
|
||||
chapters/Classical_Unsupervised_Learning/Clustering,
|
||||
chapters/Classical_Unsupervised_Learning/Density_Estimation,
|
||||
chapters/Classical_Unsupervised_Learning/Expectation_Maximization,
|
||||
chapters/Classical_Unsupervised_Learning/Variational_Auto-Encoders,
|
||||
chapters/Classical_Unsupervised_Learning/Latent_Variable_Models_and_Variational_Bayes,
|
||||
chapters/Classical_Unsupervised_Learning/Auto-Encoders,
|
||||
% %Mathematische_Grundlagen
|
||||
%chapters/Mathematische_Grundlagen/Lineare_Algebra,
|
||||
%chapters/Mathematische_Grundlagen/Probability_Theory,
|
||||
@ -102,7 +104,8 @@
|
||||
\include{chapters/Classical_Unsupervised_Learning/Clustering.tex}
|
||||
\include{chapters/Classical_Unsupervised_Learning/Density_Estimation.tex}
|
||||
\include{chapters/Classical_Unsupervised_Learning/Expectation_Maximization.tex}
|
||||
\include{chapters/Classical_Unsupervised_Learning/Variational_Auto-Encoders.tex}
|
||||
\include{chapters/Classical_Unsupervised_Learning/Latent_Variable_Models_and_Variational_Bayes}
|
||||
\include{chapters/Classical_Unsupervised_Learning/Auto-Encoders.tex}
|
||||
|
||||
\part{Mathematische Grundlagen}
|
||||
\label{part:Mathematische Grundlagen}
|
||||
|
39
Makros.tex
Normal file
39
Makros.tex
Normal file
@ -0,0 +1,39 @@
|
||||
%--------------------
|
||||
% this file contains usefull makros for various functionalities
|
||||
%--------------------
|
||||
|
||||
% {{{ reference makros %
|
||||
|
||||
% double reference (name and normal ref)
|
||||
\newcommand{\dref}[1]{\nameref{#1} (\cref{#1})}
|
||||
% }}} %
|
||||
|
||||
% {{{ math makros%
|
||||
|
||||
%special operators
|
||||
\DeclareMathOperator*{\argmax}{arg\,max}
|
||||
\DeclareMathOperator*{\argmin}{arg\,min}
|
||||
\DeclareMathOperator*{\lik}{lik}
|
||||
\DeclareMathOperator*{\loss}{loss}
|
||||
\DeclareMathOperator*{\loglik}{loglik}
|
||||
\DeclareMathOperator*{\softmax}{softmax}
|
||||
\DeclareMathOperator{\dec}{dec}
|
||||
\DeclareMathOperator{\enc}{enc}
|
||||
% }}} %
|
||||
|
||||
% {{{ acronym makros %
|
||||
|
||||
% texorpdfstring simplification
|
||||
\newcommand{\glstopfull}[1]{\texorpdfstring{\glsxtrfull{#1}}{\glsfmtfull{#1}}}
|
||||
\newcommand{\Glstopfull}[1]{\texorpdfstring{\Glsxtrfull{#1}}{\Glsfmtfull{#1}}}
|
||||
\newcommand{\glstopfullpl}[1]{\texorpdfstring{\glsxtrfullpl{#1}}{\glsfmtfullpl{#1}}}
|
||||
\newcommand{\Glstopfullpl}[1]{\texorpdfstring{\Glsxtrfullpl{#1}}{\Glsfmtfullpl{#1}}}
|
||||
\newcommand{\glstopshort}[1]{\texorpdfstring{\glsxtrshort{#1}}{\glsfmtshort{#1}}}
|
||||
\newcommand{\Glstopshort}[1]{\texorpdfstring{\Glsxtrshort{#1}}{\Glsfmtshort{#1}}}
|
||||
\newcommand{\glstopshortpl}[1]{\texorpdfstring{\glsxtrshortpl{#1}}{\glsfmtshortpl{#1}}}
|
||||
\newcommand{\Glstopshortpl}[1]{\texorpdfstring{\Glsxtrshortpl{#1}}{\Glsfmtshortpl{#1}}}
|
||||
\newcommand{\glstoplong}[1]{\texorpdfstring{\glsxtrlong{#1}}{\glsfmtlong{#1}}}
|
||||
\newcommand{\Glstoplong}[1]{\texorpdfstring{\Glsxtrlong{#1}}{\Glsfmtlong{#1}}}
|
||||
\newcommand{\glstoplongpl}[1]{\texorpdfstring{\glsxtrlongpl{#1}}{\glsfmtlongpl{#1}}}
|
||||
\newcommand{\Glstoplongpl}[1]{\texorpdfstring{\Glsxtrlongpl{#1}}{\Glsfmtlongpl{#1}}}
|
||||
% }}} %
|
@ -116,12 +116,6 @@ rightsub = \grq%
|
||||
%--------------------
|
||||
%math symbols and more
|
||||
\usepackage{amsmath}
|
||||
\DeclareMathOperator*{\argmax}{arg\,max}
|
||||
\DeclareMathOperator*{\argmin}{arg\,min}
|
||||
\DeclareMathOperator*{\lik}{lik}
|
||||
\DeclareMathOperator*{\loss}{loss}
|
||||
\DeclareMathOperator*{\loglik}{loglik}
|
||||
\DeclareMathOperator*{\softmax}{softmax}
|
||||
|
||||
%special symbols
|
||||
\usepackage{fontawesome}
|
||||
|
@ -1,8 +1,9 @@
|
||||
# Zusammenfassung Maschinelles Lernen: Grundlagen und Algorithmen
|
||||
|
||||
##TODO:
|
||||
- [ ] Folien aus der Vorlesung, auf die in der Zusammenfassung verwiesen werden einfach in den Anhang packen
|
||||
- [ ] alle ?? beseitigen
|
||||
- [ ] für alle \nameref prüfen, ob eine richtige Referenz nachfolgen sollte.
|
||||
- [ ] Folien aus der Vorlesung, auf die in der Zusammenfassung verwiesen werden einfach in den Anhang packen
|
||||
|
||||
## Notice
|
||||
Requires you to enable [--shell escape](https://tex.stackexchange.com/questions/516604/how-to-enable-shell-escape-or-write18-visual-studio-code-latex-workshop)
|
||||
|
@ -10,6 +10,7 @@
|
||||
\pagestyle{fancy}
|
||||
\fancyhf{}
|
||||
\chead{\textbf{Zusammenfassung \MODULE \\\vspace{1mm}}}
|
||||
\lhead{\leftmark}
|
||||
\lhead{\partname~\thepart}
|
||||
\rhead{\leftmark}
|
||||
\lfoot{\AUTHOR~|~\DATE}
|
||||
\rfoot{\thepage}
|
||||
|
@ -0,0 +1,83 @@
|
||||
\chapter{Latent Variable Models and Variational Bayes}%
|
||||
\label{cha:Latent Variable Models and Variational Bayes}
|
||||
|
||||
In \cref{sec:Decomposition in lower-bound and KL-term} wurde bereits gezeigt,
|
||||
wie die Decomposition für diskrete $\bm z$ aussieht.
|
||||
Für nicht-diskrete $\bm z$ ergibt sich:
|
||||
\begin{align} \label{eq:decomposition_in_lower-bound_and_KL-term_nondiscrete}
|
||||
\underbrace{\log p(\bm x)}_{\text{\glslink{marginal}{marginal} log-like}}
|
||||
&= \mathcal L(q) + \nomeq{kl_divergence}(q(\bm z)\|p(\bm z|\bm x))\\
|
||||
&= \underbrace{\int q(\bm z)\log \frac{p(\bm x|\bm z)p(\bm z)}{q(z)} d\bm z}_{\text{Lower-Bound $\mathcal L(q)$}}
|
||||
+ \underbrace{\int q(\bm z)\log \frac{q(\bm z)}{p(\bm z|\bm x)}}_{\text{\noms{kl_divergence}: $\nomeq{kl_divergence}(q(\bm z)\|p(\bm z|\bm x))$}}
|
||||
\end{align}
|
||||
\begin{itemize}
|
||||
\item $q(\bm z)$ wird hierbei auch als \say{variational\slash\,auxiliary distribution} bezeichnet
|
||||
\end{itemize}
|
||||
Bei der Expectation Maximization (\cref{cha:Expectation Maximization}) wurde an dieser Stelle davon ausgegangen,
|
||||
dass die \gls{KL}-Divergenz eine \gls{closed_form_solution} hat
|
||||
und daher nach dem Expectation-Step (\cref{sub:Expectation-Step}) $\nomeq{kl_divergence}(q(\bm z)\|p(\bm z|\bm x)) = 0$ gilt.
|
||||
Mithilfe des Satzes von Bayes (\cref{sub:Bayes Rule}) lässt sich allerdings zeigen,
|
||||
dass
|
||||
$$\argmin_q \nomeq{kl_divergence}(q(\bm z)\|p(\bm z|\bm x)) = \argmax_q \mathcal L(q,p)$$
|
||||
gilt (Herleitung: {\color{red} Vorlesung 12 Folie 13 und 14}).
|
||||
Daraus folgt,
|
||||
dass die Maximierung der \glslink{marginal}{Marginal} Log-Likelihood immer noch sichergestellt ist,
|
||||
da die \gls{KL}-Divergenz bereits minimal ist ($q(\bm z)\approx p(\bm z|\bm x)$),
|
||||
wenn die Lower Bound maximiert ist.
|
||||
|
||||
Für einen ganzen Datensatz lässt sich die Lower Bound wie folgt definieren:
|
||||
\begin{equation} \label{eq:VAE:lower_bound_whole_dataset}
|
||||
\mathcal L(\{q_i\},p) = \frac{1}{N}\sum_i\int q_i(\bm z)\log p(\bm x_i|\bm z)d\bm z - \nomeq{kl_divergence}(q_i(\bm z)\|p(\bm z))
|
||||
\end{equation}
|
||||
\begin{itemize}
|
||||
\item $q_i$: individuelle Variational Distribution für jeden Datenpunkt
|
||||
\end{itemize}
|
||||
Dies hat zwei Vorteile:
|
||||
\begin{enumerate}
|
||||
\item erlaubt direkteres Samplen
|
||||
\begin{itemize}
|
||||
\item kein Samplen von $p(\bm z)$ nötig,
|
||||
stattdessen kann direkt von $q_i(\bm z)\approx p(\bm z|\bm x_i)$ gesampelt werden.
|
||||
\item nach der Optimierung erzeugt jedes $q_i(\bm z)$ Samples mit hohem $p(\bm x|\bm z)$
|
||||
\end{itemize}
|
||||
\item das Integral ist außerhalb der $\log$-Funktion
|
||||
\begin{itemize}
|
||||
\item es wird nur ein Sample von $q_i(\bm z)$ benötigt, um eine Abschätzung ohne Bias zu ermöglichen
|
||||
\item kann für den \gls{SDG} (\cref{sub:SDG}) verwendet werden,
|
||||
obwohl die \glslink{marginal}{Marginal} Log-Likelihood hierfür ungeeignet wäre
|
||||
\end{itemize}
|
||||
\end{enumerate}
|
||||
Für die Maximierung dieser Lower Bound gibt es im Grunde genommen zwei Verfahren:
|
||||
|
||||
\paragraph{Special Case 1: \glstoplong{EM}}%
|
||||
\label{par:Special Case 1: Expectation Maximization}
|
||||
\mbox{}\\
|
||||
\includegraphics[scale=.5]{VAE_special_case_1:_expectation_maximization.png}
|
||||
|
||||
\paragraph{Special Case 2: Amortized Variational Inference}%
|
||||
\label{par:Special Case 2: Amortized Variational Inference}
|
||||
\mbox{}\\
|
||||
Das \say{Amortized Variational Inference} Verfahren ist das Standardverfahren,
|
||||
welches in \dref{sec:VAEs} zum Einsatz kommt.
|
||||
Hierbei wird statt einer auxiliary distribution $q_i(\bm z)$ für jeden Datenpunkt $x_i$ eine amortisierte Verteilung (armortized distribution) $q_\phi(\bm z|\bm x_i)$ verwendet,
|
||||
welche mittels eines \gls{DNN} (\cref{Deep Neural Networkd}) erstellt wird.
|
||||
Hierdurch lässt sich die Lower Bound Funktion wie folgt umschreiben:
|
||||
\begin{equation} \label{eq:amortized_variational_inference_lower_bound}
|
||||
\mathcal L(q,p) = \frac{1}{N}\sum_i\int q_\phi(\bm z|\bm x_i)\log p_{\bm \varphi}(\bm x_i|\bm z)d\bm z - \nomeq{kl_divergence}(q_\phi(\bm z|\bm x_i)\|p_{\bm\varphi}(\bm z))
|
||||
\end{equation}
|
||||
\begin{itemize}
|
||||
\item Encoder \tabto{3cm}$q_\phi(\bm z|\bm x)$
|
||||
\item Decoder \tabto{3cm}$p_{\bm\varphi}(\bm x|\bm z)$
|
||||
\item Latent Prior \tabto{3cm}$p_{\bm\varphi}(\bm z)$
|
||||
\end{itemize}
|
||||
Da die Samples hier nicht vorgegeben sind,
|
||||
sondern generiert werden,
|
||||
unterscheidet sich dieses Verfahren vom Maximum-Log-Likelihood (\cref{maximum log-lik}).
|
||||
Zudem ist die Verwendung von Gradienten sehr ineffizient.
|
||||
Abhilfe biete der \say{Reparameterization Trick} (siehe {\color{red} Vorlesung 12 Folie 19 und 20}),
|
||||
welcher es ermöglicht,
|
||||
die Lower Bound wie folgt umzuschreiben (mehr Details: {\color{red} Vorlesung 12 Folie 21}):
|
||||
\begin{equation} \label{eq:amortized_variational_inference_reparametrized_lower_bound}
|
||||
\mathcal L(q,p) = \frac{1}{N} \sum_i\int p(\bm\xi) (\underbrace{\log p_{\bm\varphi}(\bm x_i|\bm h(\bm\xi,\bm x))}_{\text{reconstruction}}
|
||||
+ \underbrace{\log p_{\bm\varphi}(\bm h(\bm xi,\bm x)) - \log q_\phi(\bm h(\bm\xi,\bm x)|\bm x)}_{\text{\glsxtrshort{KL}-term}})
|
||||
\end{equation}
|
BIN
images/VAE_special_case_1:_expectation_maximization.png
Normal file
BIN
images/VAE_special_case_1:_expectation_maximization.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 MiB |
Loading…
x
Reference in New Issue
Block a user