Prerequisites#
A Restricted Boltzmann Machine (RBM) is an energy-based probabilistic graphical model composed of a visible layer and a hidden layer, with no intra-layer connections but full inter-layer connections. Its core idea is to learn the latent feature distribution of data through unsupervised learning.
1. Neural Network Basics#
1.1 Neuron Model#
The artificial neuron is the basic computing unit of a neural network. Given an input vector , its output is:
where is the weight vector, is the bias term, and is the activation function. In probabilistic generative models the Sigmoid activation is commonly used:
1.2 Energy-Based Models#
Unlike feed-forward networks, Energy-Based Models (EBMs) define a probability distribution over data through a scalar energy function :
where the partition function is:
It ensures proper normalization. States with lower energy correspond to higher probability.
2. Boltzmann Machine Structure#
Visible layer (v): the explicit representation of input data (e.g. pixel values).
Hidden layer (h): extracted latent features.
Weight matrix (w): weights connecting visible and hidden layers.
Biases: visible-layer bias (b) and hidden-layer bias (c).
A Boltzmann Machine (BM) is fully connected, whereas the Restricted Boltzmann Machine removes intra-layer connections, making Gibbs sampling far more efficient.
Thanks to the restricted structure, hidden variables are mutually independent given the visible variables, with conditional probability:
Similarly,
3. Energy Function and Probability Distribution#
3.1 Energy Function#
The RBM energy function is defined as:
where are the states of the visible and hidden layers, is the connection weight matrix, and are the first-order coefficients.
The joint probability distribution is given by the Boltzmann distribution:
where is the partition function (normalization factor). The marginal distribution over the visible layer is:
Parameters are learned by maximizing the likelihood. The objective is the negative log-likelihood:
Contrastive Divergence (CD) is used to approximate the gradient; the update rule is:
where is the learning rate, and , denote expectations under the data and reconstruction distributions, respectively.
3.2 Gradient Derivation#
The probability of an energy model can be written as:
Its gradient is:
The gradient of the partition function is hard to compute directly:
For models that guarantee for every , we can replace with .
Putting it together,
In the second term is the distribution predicted by the model, while the first term in training is under the real data distribution. Thus the equation can be rewritten as:
Considering the Boltzmann-machine energy function, we can easily obtain:
One only needs to obtain the values of and under and respectively to compute the gradient, namely: