# Restricted Boltzmann Machines

##### Posted on 0 Comments

## Boltzmann Machines

Boltzmann Machines are a particular form of log-linear Markov Random Field. In order to make them powerful enough to represent complicated distributions, such as going from the limited parametric setting to a non-parametric one, we introduce the hidden variables (or hidden units). With more hidden units, we can increase the modeling capacity of the Boltzmann Machine.

Consider a graph $G=(V,E)$, which has $p$ visible nodes, termed as $X_j, j=1,2,\ldots, p$, and $X_j$ is a binary variable. Denote the inverse covariance matrix of $X$ as $\mathbf \Theta$, which contains information about the *partial covariances* between variables. The *partial covariances* between pairs $i$ and $j$ are the covariances of them conditional on all other variables. In particular, if the $ij$th component of $\mathbf \Theta$ is zero, then variable $i$ and $j$ are conditional independent, given the other variables.

Given some data from this model, the log-likelihood is

The gradient of this log-likelihood is

Now suppose a subset of the variables $X_{\cal H}$ are hidden, and the remainder $X_{\cal V}$ are visible. Then the log-likelihood of the observed data is

The gradient works out to be

The inner expectation in the first term can be calculated by using basic rules of conditional expectation and properties of Bernoulli random variables. As a result,

In principle, we can implement two separate runs of Gibbs sampling.

- Estimate $E_{\mathbf\Theta}(X_jX_k)$ by sampling from the model.
- Estimate $E_{\mathbf\Theta}(X_jX_k\mid X_{\cal V}=x_{i\cal V})$

However, this procedure can be very slow. Fortunately, restricted Boltzmann machines can make these computations manageable.

## Restricted Boltzmann Machines

As you can see in the above figure, a restricted Boltzmann Machine is a Boltzmann machine in which there are no connections between nodes in the same layer. Then the conditional expectation can be easier,

Considering the fact that the set of visible and hidden units are conditionally independent. So we can sample visible units simultaneously given fixed values of the hidden units. Similarly, hidden units can be sampled simultaneously given the visible units. A schematic diagram is as follows.

## Implement on MNIST

There is a python program which use restricted Boltzmann machine to recognize hand-written digits from the MNIST dataset. In this program, it constructs a RBM with 784 visible units and 500 hidden units, using contrastive divergence. But it did not use the label information. You can find the code in the first reference at the end of this post.