TabMBase<T>
Base Classes · AiDotNet.NeuralNetworks.Tabular
Base implementation of TabM, a parameter-efficient ensemble model for tabular data.
Known derived types: TabMClassifier<T>, TabMRegression<T>
For Beginners
TabM is a neural network that combines the power of ensemble methods (multiple models voting) with the efficiency of parameter sharing.
Architecture overview:
- Input Layer: Raw features or embedded features
- Hidden Layers: BatchEnsemble layers with shared weights + per-member modulation
- Output Layer: Predictions for each ensemble member
- Aggregation: Average (or other) of member predictions
Why TabM works well:
- Ensembles reduce variance and improve generalization
- Parameter sharing keeps the model small and efficient
- Diverse members (via rank vectors) capture different aspects of the data
- Training is stable and convergence is fast
Comparison to other methods:
- vs Gradient Boosting: Often similar performance, TabM is more parallelizable
- vs Random Forests: TabM learns feature interactions, RF doesn’t
- vs Deep Ensembles: TabM is 4-10x more parameter efficient
How It Works
TabM uses BatchEnsemble-style parameter sharing to create multiple ensemble members with minimal parameter overhead. The architecture consists of:
- Optional feature embedding layer
- Multiple BatchEnsemble hidden layers with activation and normalization
- Prediction head
Properties
| Property | Summary |
|---|---|
int NumMembers { get; } |
Gets the number of ensemble members. |
int[] HiddenDimensions { get; } |
Gets the hidden layer dimensions. |
long ParameterCount { get; } |
Gets the total number of trainable parameters in the base model. |
Methods
| Method | Summary |
|---|---|
Vector<T> GetEnsembleDiversity(Tensor<T> memberOutputs, int outputDim) |
Gets the diversity of ensemble predictions (standard deviation across members). |
Vector<T> GetParameterGradients() |
Gets parameter gradients as a single vector. |
Vector<T> GetParameters() |
Gets all trainable parameters as a single vector. |
void ResetState() |
Resets internal state. |
void SetParameters(Vector<T> parameters) |
Sets all trainable parameters from a vector. |
void UpdateParameters(T learningRate) |
Updates all parameters using the calculated gradients. |