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:

  1. Input Layer: Raw features or embedded features
  2. Hidden Layers: BatchEnsemble layers with shared weights + per-member modulation
  3. Output Layer: Predictions for each ensemble member
  4. 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:

  1. Optional feature embedding layer
  2. Multiple BatchEnsemble hidden layers with activation and normalization
  3. 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.