update on BM slides
This commit is contained in:
@@ -43,7 +43,7 @@ Furthermore, they have been used to solve complicated quantum mechanical many-pa
|
||||
!split
|
||||
===== An intermediate step, the Hopfield network and links to the Ising and Potts models =====
|
||||
|
||||
More material on Hopfield networks will come here
|
||||
More material on Hopfield networks will come here later.
|
||||
|
||||
!split
|
||||
===== A brief review on Markov Chains, Metropolis and Gibbs sampling =====
|
||||
@@ -983,6 +983,46 @@ Why use a generative model rather than the more well known discriminative deep n
|
||||
History: The RBM was developed by amongst others Geoffrey Hinton, called by some the "Godfather of Deep Learning", working with the University of Toronto and Google.
|
||||
|
||||
|
||||
!split
|
||||
===== Boltzmann machines (BM) =====
|
||||
|
||||
!bblock
|
||||
A BM is what we would call an undirected probabilistic graphical model
|
||||
with stochastic continuous or discrete units.
|
||||
!eblock
|
||||
!bblock
|
||||
It is interpreted as a stochastic recurrent neural network where the
|
||||
state of each unit(neurons/nodes) depends on the units it is connected
|
||||
to. The weights in the network represent thus the strength of the
|
||||
interaction between various units/nodes.
|
||||
!eblock
|
||||
!bblock
|
||||
It turns into a Hopfield network if we choose deterministic rather
|
||||
than stochastic units. In contrast to a Hopfield network, a BM is a
|
||||
so-called generative model. It allows us to generate new samples from
|
||||
the learned distribution.
|
||||
!eblock
|
||||
|
||||
!split
|
||||
===== A standard BM setup =====
|
||||
|
||||
!bblock
|
||||
A standard BM network is divided into a set of observable and visible units $\hat{x}$ and a set of unknown hidden units/nodes $\hat{h}$.
|
||||
!eblock
|
||||
|
||||
!bblock
|
||||
Additionally there can be bias nodes for the hidden and visible layers. These biases are normally set to $1$.
|
||||
!eblock
|
||||
|
||||
!bblock
|
||||
BMs are stackable, meaning they cwe can train a BM which serves as input to another BM. We can construct deep networks for learning complex PDFs. The layers can be trained one after another, a feature which makes them popular in deep learning
|
||||
!eblock
|
||||
|
||||
However, they are often hard to train. This leads to the introduction of so-called restricted BMs, or RBMS.
|
||||
Here we take away all lateral connections between nodes in the visible layer as well as connections between nodes in the hidden layer. The network is illustrated in the figure below.
|
||||
|
||||
|
||||
|
||||
!split
|
||||
===== The structure of the RBM network =====
|
||||
|
||||
@@ -1011,8 +1051,11 @@ _The network parameters, to be optimized/learned_:
|
||||
o $\mathbf{b}$ represents the hidden bias, a vector of same lenght as $\mathbf{h}$.
|
||||
o $W$ represents the interaction weights, a matrix of size $M\times N$.
|
||||
|
||||
|
||||
|
||||
|
||||
!split
|
||||
===== Joint distribution and the Energy function =====
|
||||
===== Joint distribution =====
|
||||
The restricted Boltzmann machine is described by a Bolztmann distribution
|
||||
!bt
|
||||
\begin{align}
|
||||
@@ -1027,8 +1070,11 @@ where $Z$ is the normalization constant or partition function, defined as
|
||||
!et
|
||||
It is common to ignore $T_0$ by setting it to one.
|
||||
|
||||
|
||||
|
||||
|
||||
!split
|
||||
===== Network Elements =====
|
||||
===== Network Elements, the energy function =====
|
||||
|
||||
The function $E(\mathbf{x},\mathbf{h})$ gives the _energy_ of a
|
||||
configuration (pair of vectors) $(\mathbf{x}, \mathbf{h})$. The lower
|
||||
@@ -1037,6 +1083,19 @@ function also depends on the parameters $\mathbf{a}$, $\mathbf{b}$ and
|
||||
$W$. Thus, when we adjust them during the learning procedure, we are
|
||||
adjusting the energy function to best fit our problem.
|
||||
|
||||
An expression for the energy function is
|
||||
!bt
|
||||
\[
|
||||
E(\hat{x},\hat{h}) = -\sum_{ia}^{NA}b_i^a \alpha_i^a(x_i)-\sum_{jd}^{MD}c_j^d \beta_j^d(h_j)-\sum_{ijad}^{NAMD}b_i^a \alpha_i^a(x_i)c_j^d \beta_j^d(h_j)w_{ij}^{ad}.
|
||||
\]
|
||||
!et
|
||||
|
||||
Here $\beta_j^d(h_j)$ and $\alpha_i^a(x_j)$ are so-called transfer functions that map a given input value to a desired feature value. The labels $a$ and $d$ denote that there can be multiple transfer functions per variable. The first sum depends only on the visible units. The second on the hidden ones. _Note_ that there is no connection between nodes in a layer.
|
||||
|
||||
The quantities $b$ and $c$ can be interpreted as the visible and hidden biases, respectively.
|
||||
|
||||
The connection between the nodes in the two layers is given by the weights $w_{ij}$.
|
||||
|
||||
!split
|
||||
===== Defining different types of RBMs =====
|
||||
There are different variants of RBMs, and the differences lie in the types of visible and hidden units we choose as well as in the implementation of the energy function $E(\mathbf{x},\mathbf{h})$.
|
||||
@@ -1135,6 +1194,7 @@ Our cost function is the negative log-likelihood, $\mathcal{C}(\{ \theta_i \}) =
|
||||
|
||||
!split
|
||||
===== Optimization / Training =====
|
||||
|
||||
The training procedure of choice often is Stochastic Gradient Descent (SGD). It consists of a series of iterations where we update the parameters according to the equation
|
||||
!bt
|
||||
\begin{align}
|
||||
@@ -1207,3 +1267,71 @@ Carleo and Troyer applied the RBM to the quantum mechanical spin lattice systems
|
||||
|
||||
|
||||
|
||||
!split
|
||||
===== Representing the wave function =====
|
||||
The wavefunction should be a probability amplitude depending on $\bm{x}$. The RBM model is given by the joint\
|
||||
distribution of $\bm{x}$ and $\bm{h}$
|
||||
!bt
|
||||
\begin{align}
|
||||
F_{rbm}(\mathbf{x},\mathbf{h}) = \frac{1}{Z} e^{-\frac{1}{T_0}E(\mathbf{x},\mathbf{h})}.
|
||||
\end{align}
|
||||
!et
|
||||
To find the marginal distribution of $\bm{x}$ we set:
|
||||
!bt
|
||||
\begin{align}
|
||||
F_{rbm}(\mathbf{x}) &= \sum_\mathbf{h} F_{rbm}(\mathbf{x}, \mathbf{h}) \\
|
||||
&= \frac{1}{Z}\sum_\mathbf{h} e^{-E(\mathbf{x}, \mathbf{h})}.
|
||||
\end{align}
|
||||
!et
|
||||
|
||||
Now this is what we use to represent the wave function, calling it a neural-network quantum state (NQS)
|
||||
!bt
|
||||
\begin{align}
|
||||
\Psi (\mathbf{X}) &= F_{rbm}(\mathbf{x}) \\
|
||||
&= \frac{1}{Z}\sum_{\bm{h}} e^{-E(\mathbf{x}, \mathbf{h})} \\
|
||||
&= \frac{1}{Z} \sum_{\{h_j\}} e^{-\sum_i^M \frac{(x_i - a_i)^2}{2\sigma^2} + \sum_j^N b_j h_j + \sum_\
|
||||
{i,j}^{M,N} \frac{x_i w_{ij} h_j}{\sigma^2}} \\
|
||||
&= \frac{1}{Z} e^{-\sum_i^M \frac{(x_i - a_i)^2}{2\sigma^2}} \prod_j^N (1 + e^{b_j + \sum_i^M \frac{x\
|
||||
_i w_{ij}}{\sigma^2}}). \\
|
||||
\end{align}
|
||||
!et
|
||||
|
||||
|
||||
!split
|
||||
===== Choose the cost function =====
|
||||
Now we don't necessarily have training data (unless we generate it by using some other method). However, what we do have is the variational principle which allows us to obtain the ground state wave function by minimizing the expectation value of the energy of a trial wavefunction (corresponding to the untrained NQS). Similarly to the traditional variational Monte Carlo method then, it is the local energy we wish to minimize. The gradient to use for the stochastic gradient descent procedure is
|
||||
!bt
|
||||
\begin{align}
|
||||
G_i = \frac{\partial \langle E_L \rangle}{\partial \theta_i}
|
||||
= 2(\langle E_L \frac{1}{\Psi}\frac{\partial \Psi}{\partial \theta_i} \rangle - \langle E_L \rangle \langle \frac{1}{\Psi}\frac{\partial \Psi}{\partial \theta_i} \rangle ),
|
||||
\end{align}
|
||||
!et
|
||||
where the local energy is given by
|
||||
!bt
|
||||
\begin{align}
|
||||
E_L = \frac{1}{\Psi} \hat{\mathbf{H}} \Psi.
|
||||
\end{align}
|
||||
!et
|
||||
|
||||
|
||||
!split
|
||||
===== Running the codes =====
|
||||
!bblock
|
||||
You can find the codes for the simple two-electron case at the Github repository URL:"https://github.com/mhjensenseminars/MachineLearningTalk/tree/master/doc/Programs/MLcpp/src". Python codes to come, only c++ as of now.
|
||||
|
||||
The trial wave function is based on the product of a Slater determinant with Gaussian orbitals, a simple Jastrow factor $\exp{(r_{ij})}$ and the reduced Boltzmann machines.
|
||||
|
||||
The Broyden-Fletcher-Goldfarb-Shanno algorithm was used to perform the minimization. We used $14$ hidden nodes in the calculations below.
|
||||
|
||||
!eblock
|
||||
|
||||
|
||||
|
||||
|
||||
!split
|
||||
===== Energy as function of iterations, $N=2$ electrons =====
|
||||
!bblock
|
||||
FIGURE: [figures/figN2.pdf, width=700 frac=0.9]
|
||||
!eblock
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user