TabMNetwork<T>
Models & Types · AiDotNet.NeuralNetworks.Tabular
TabM (Parameter-Efficient Ensemble) neural network for tabular data.
Inheritance: NeuralNetworkBase<T> → TabularNeuralNetworkBase<T> → TabMNetwork<T>
For Beginners
TabM gets ensemble benefits efficiently:
Architecture:
- Shared Base Weights: Core network weights shared by all ensemble members
- Rank Vectors: Small per-member vectors that customize each member
- Weight Modulation: Rank vectors scale the shared weights
- Ensemble Aggregation: Average or concatenate member predictions
Key insight: Traditional ensembles need N times the parameters for N models. TabM only adds about 1-5% extra parameters per member while getting similar benefits. This is like having multiple experts share most of their knowledge but each having their own “style” or perspective.
How It Works
TabM uses BatchEnsemble-style parameter sharing to create multiple ensemble members with minimal parameter overhead. Each member shares base weights but has its own small rank vectors that modulate the shared weights. 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: “TabM: Advancing Tabular Deep Learning With Parameter-Efficient Ensembling” (2024)
Example
var architecture = new NeuralNetworkArchitecture<float>(inputFeatures: 8, outputSize: 4);
var options = new TabMOptions<double> { NumFeatures = 20};
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 TabMNetwork<float>(architecture))
.Build(trainX, trainY);
var output = result.Predict(input);
Constructors
| Constructor | Summary |
|---|---|
TabMNetwork() |
Initializes a new TabM network with default configuration. |
TabMNetwork(NeuralNetworkArchitecture<T> architecture, TabMOptions<T> options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction) |
Initializes a new TabM network with the specified architecture. |
Properties
| Property | Summary |
|---|---|
TabMOptions<T> Options { get; } |
Gets the TabM-specific options. |
int NumEnsembleMembers { get; } |
Gets the number of ensemble members. |
Methods
| Method | Summary |
|---|---|
Dictionary<string, T> GetFeatureImportance() |
|
ModelMetadata<T> GetModelMetadata() |