DeepBeliefNetwork<T>
Models & Types · AiDotNet.NeuralNetworks
Represents a Deep Belief Network, a generative graphical model composed of multiple layers of Restricted Boltzmann Machines.
Inheritance: NeuralNetworkBase<T> → DeclaredModelLayoutBase<T> → VectorModelLayoutBase<T> → DeepBeliefNetwork<T>
For Beginners
A Deep Belief Network is like a tower of pattern-recognizing layers.
Imagine building a tower where:
- Each floor of the tower is a Restricted Boltzmann Machine (RBM)
- The bottom floor learns simple patterns from the raw data
- Each higher floor learns more complex patterns based on what the floor below it discovered
- The tower is built and trained one floor at a time, from bottom to top
For example, if analyzing images of faces:
- The first floor might learn to detect edges and basic shapes
- The middle floors might recognize features like eyes, noses, and mouths
- The top floors might identify complete facial expressions or identities
This layer-by-layer approach helps the network discover meaningful patterns even when you don’t have a lot of labeled examples.
How It Works
A Deep Belief Network (DBN) is a probabilistic, generative model composed of multiple layers of stochastic latent variables. It is built by stacking multiple Restricted Boltzmann Machines (RBMs), where each RBM’s hidden layer serves as the input layer for the next RBM. DBNs are trained using a two-phase approach: an unsupervised pre-training phase followed by a supervised fine-tuning phase. This allows them to learn complex patterns in data even with limited labeled examples.
Example
var architecture = new NeuralNetworkArchitecture<float>(
inputType: InputType.OneDimensional,
taskType: NeuralNetworkTaskType.Regression,
inputSize: 784,
outputSize: 10);
var input = Tensor<float>.CreateRandom(new[] { 1, 784 });
var trainX = Tensor<float>.CreateRandom(4, 8);
var trainY = Tensor<float>.CreateRandom(4, 2);
var result = new AiModelBuilder<float, Tensor<float>, Tensor<float>>()
.ConfigureModel(new DeepBeliefNetwork<float>(architecture))
.Build(trainX, trainY);
var output = result.Predict(input);
Constructors
| Constructor | Summary |
|---|---|
DeepBeliefNetwork() |
Initializes a new instance with default architecture settings. |
DeepBeliefNetwork(NeuralNetworkArchitecture<T> architecture, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction, DeepBeliefNetworkOptions options) |
Initializes a new instance of the DeepBeliefNetwork class with the specified architecture. |
Properties
| Property | Summary |
|---|---|
bool SupportsTraining { get; } |
Indicates whether the network supports training (learning from data). |
Methods
| Method | Summary |
|---|---|
ModelMetadata<T> GetModelMetadata() |
Gets metadata about the Deep Belief Network model. |
void PreTrain(Tensor<T> input, int epochsPerLayer, double learningRate) |
Greedy layer-wise pre-training of the stacked RBMs via Contrastive Divergence per Hinton 2006 (“A fast learning algorithm for deep belief nets”) and Hinton & Salakhutdinov 2006 (“Reducing the Dimensionality of Data with Neural Networks”). |