AI & ML Atlas
Neural NetworksalgorithmAnimated walkthrough
Contrastive Divergence
A shortcut for training RBMs using just a few sampling steps.
The idea
Exact Boltzmann learning needs samples from the model at equilibrium. Contrastive divergence starts the model at a data example, runs only k (often 1) steps of alternating sampling and uses the resulting "reconstruction" as a stand-in. The weights move to make data more likely and reconstructions less likely.
ΔW = η (⟨vhᵀ⟩_data − ⟨vhᵀ⟩_recon)
Watch it run
The pipeline lights up one step at a time. Use the controls to pause or step through it.
- 1Set the visible units to a training example v.
- 2Sample the hidden units h from v.
- 3Sample a reconstruction v′ from h, then h′ from v′.
- 4Update W by η (v hᵀ − v′ h′ᵀ).
ΔW = η (⟨vhᵀ⟩_data − ⟨vhᵀ⟩_recon)
1/4
Step by step
- 1Set the visible units to a training example v.
- 2Sample the hidden units h from v.
- 3Sample a reconstruction v′ from h, then h′ from v′.
- 4Update W by η (v hᵀ − v′ h′ᵀ).
Where it is used
Training restricted Boltzmann machines.
Watch out for
The gradient is biased, though it works well in practice.