MambularNetwork<T>
Models & Types · AiDotNet.NeuralNetworks.Tabular
Mambular (State Space Model for Tabular Data) neural network.
Inheritance: NeuralNetworkBase<T> → TabularNeuralNetworkBase<T> → MambularNetwork<T>
For Beginners
Mambular treats features like a sequence:
Architecture:
- Feature Embedding: Convert features to learned representations
- State Space Layers: Process features sequentially with memory
- Selective Mechanism: Learn which features to remember/forget
- MLP Head: Final prediction from processed features
Key insight: State space models (like Mamba) are more efficient than transformers for long sequences. For tabular data with many features, this can provide both better scaling and learned sequential relationships.
How It Works
Mambular applies the Mamba state space model architecture to tabular data, treating features as a sequence and using selective state spaces for processing. This implementation follows the standard neural network architecture pattern with:
- Proper inheritance from NeuralNetworkBase
- Layer-based architecture using ILayer components
- Engine-based tensor operations for CPU/GPU acceleration
- Full autodiff and JIT compilation support
Reference: “Mambular: A Sequential Model for Tabular Deep Learning” (2024)
Example
var architecture = new NeuralNetworkArchitecture<float>(inputFeatures: 8, outputSize: 4);
var options = new MambularOptions<double> { NumFeatures = 20, NumLayers = 4 };
var input = Tensor<float>.CreateRandom(new[] { 1, 20 });
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 MambularNetwork<float>(architecture))
.Build(trainX, trainY);
var output = result.Predict(input);
Constructors
| Constructor | Summary |
|---|---|
MambularNetwork() |
Initializes a new instance with default architecture settings. |
MambularNetwork(NeuralNetworkArchitecture<T> architecture, MambularOptions<T> options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction) |
Initializes a new Mambular network with the specified architecture. |
Properties
| Property | Summary |
|---|---|
MambularOptions<T> Options { get; } |
Gets the Mambular-specific options. |
int EmbeddingDimension { get; } |
Gets the embedding dimension. |
int NumLayers { get; } |
Gets the number of layers. |
int StateDimension { get; } |
Gets the state dimension for the SSM. |
Methods
| Method | Summary |
|---|---|
Dictionary<string, T> GetFeatureImportance() |
|
ModelMetadata<T> GetModelMetadata() |