DeepBoltzmannMachine<T>

Models & Types · AiDotNet.NeuralNetworks

Represents a Deep Boltzmann Machine (DBM), a hierarchical generative model consisting of multiple layers of stochastic neurons.

Inheritance: NeuralNetworkBase<T> → DeclaredModelLayoutBase<T> → VectorModelLayoutBase<T> → DeepBoltzmannMachine<T>

For Beginners

A Deep Boltzmann Machine is like a multi-story pattern detector.

Think of it as a series of layers, each learning increasingly abstract patterns:

  • The visible layer represents the raw data (e.g., pixel values in an image)
  • The first hidden layer might learn simple patterns (e.g., edges, corners)
  • Higher hidden layers learn more complex patterns (e.g., shapes, objects)
  • The deeper the network, the more abstract the patterns it can learn

For example, in an image recognition system:

  • Layer 1 might detect edges and basic textures
  • Layer 2 might combine these into simple shapes
  • Layer 3 might recognize more complex objects

DBMs can both recognize patterns in data and generate new data with similar patterns.

How It Works

A Deep Boltzmann Machine is an extension of the Restricted Boltzmann Machine to multiple hidden layers. It consists of a visible layer and multiple hidden layers with connections between adjacent layers but no connections within the same layer. DBMs are used for unsupervised learning, feature extraction, and generative modeling.

Example

var architecture = new NeuralNetworkArchitecture<float>(
    inputType: InputType.OneDimensional,
    taskType: NeuralNetworkTaskType.Regression,
    inputSize: 784,
    outputSize: 784);
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 DeepBoltzmannMachine<float>(architecture))
    .Build(trainX, trainY);
var output = result.Predict(input);

Constructors

Constructor Summary
DeepBoltzmannMachine() Initializes a new instance with default settings.
DeepBoltzmannMachine(NeuralNetworkArchitecture<T> architecture, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction, IActivationFunction<T> activationFunction, DeepBoltzmannMachineOptions options) Initializes a new instance of the DeepBoltzmannMachine class with vector activation.
DeepBoltzmannMachine(NeuralNetworkArchitecture<T> architecture, IVectorActivationFunction<T> vectorActivationFunction, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction, DeepBoltzmannMachineOptions options) Initializes a new instance of the DeepBoltzmannMachine class with vector activation.

Methods

Method Summary
ModelMetadata<T> GetModelMetadata() Gets metadata about the Deep Boltzmann Machine model.
void PretrainLayerwise(Tensor<T> input, int pretrainingEpochs, T pretrainingLearningRate) Performs layer-wise pretraining of the DBM using a greedy approach.