# Restricted Boltzmann machine

A restricted Boltzmann machine, commonly abbreviated as RBM, is a neural network where neurons beyond the visible have probabilitistic outputs. The machine is restricted because connections are restricted to be from one layer to the next, that is, having no intra-layer connections.

## Model Model of a neuron. j is the index of the neuron when there is more than one neuron. For the RBM, the activation function is logistic.

We use a set of binary-valued neurons. Given a set of k-dimensional inputs represented as a column vector $\vec{x} = [x_1, x_2, \cdots, x_k]^T$, and a set of m neurons with (initially random, between -0.01 and 0.01) synaptic weights from the inputs, represented as a matrix formed by m weight column vectors (i.e. a k row x m column matrix):

$\mathbf{W} = \begin{bmatrix} w_{11} & w_{12} & \cdots & w_{1m}\\ w_{21} & w_{22} & \cdots & w_{2m}\\ \vdots & & & \vdots \\ w_{k1} & w_{m2} & \cdots & w_{km} \end{bmatrix}$

where $w_{ij}$ is the weight between input i and neuron j, the output of the set of neurons is defined as follows:

$P \left ( y_j=1 \right ) = \varphi \left ( \sum_i x_i w_{ij} \right )$

where $\varphi \left ( \cdot \right )$ is the logistic sigmoidal function:

$\varphi \left ( \nu \right ) = \frac{1}{1+e^{-\nu}}$

From this output, a binary-valued reconstruction of the input $\vec{x'}$ is formed as follows:

$P \left ( x'_i=1 \right ) = \varphi \left ( \sum_j y_j w_{ij} \right )$

To update the weights, a set of inputs are presented, the outputs generated, and the inputs reconstructed. In practice, the reconstruction is then fed back to the input layer and another cycle is run, for several cycles, which is known as Gibbs sampling. Then an average is taken over the results, and the weights are updated as follows:

$\Delta w_{ij} = \eta \left ( \langle x_i y_j \rangle_N - \langle x'_i y_j \rangle_N \right )$

where $\eta$ is some learning rate and the subscript $N$ indicates that the average is taken over $N$ input presentations.