TabMRegression<T>

Models & Types · AiDotNet.NeuralNetworks.Tabular

TabM implementation for regression tasks.

Inheritance: TabMBase<T> → TabMRegression<T>

For Beginners

Use this model when you want to predict continuous values (like prices, temperatures, etc.) with the benefits of an ensemble.

How predictions work:

  1. Input passes through shared layers with per-member modulation
  2. Each ensemble member produces a prediction
  3. Predictions are averaged for the final output
  4. Variance across members provides uncertainty estimate

Benefits over single models:

  • Better generalization through ensemble averaging
  • Built-in uncertainty quantification
  • More robust to outliers
  • Comparable speed to single models

Example:

How It Works

TabMRegression uses the TabM architecture with BatchEnsemble layers for regression. It averages predictions across ensemble members and can provide uncertainty estimates.

Constructors

Constructor Summary
TabMRegression(int numFeatures, int outputDimension, TabMOptions<T> options) Initializes a new instance of the TabMRegression class.

Properties

Property Summary
int OutputDimension { get; } Gets the output dimension.

Methods

Method Summary
Dictionary<string, T> ComputeCalibrationMetrics(Tensor<T> features, Tensor<T> targets) Computes calibration metrics for uncertainty estimates.
T ComputeMAELoss(Tensor<T> predictions, Tensor<T> targets) Computes the Mean Absolute Error (MAE) loss.
T ComputeMSELoss(Tensor<T> predictions, Tensor<T> targets) Computes the Mean Squared Error (MSE) loss.
T ComputeNLL(Tensor<T> features, Tensor<T> targets) Computes Negative Log Likelihood assuming Gaussian predictions.
T ComputeR2Score(Tensor<T> features, Tensor<T> targets) Computes the R² score (coefficient of determination).
T ComputeRMSE(Tensor<T> features, Tensor<T> targets) Computes the Root Mean Squared Error (RMSE).
T TrainStep(Tensor<T> features, Tensor<T> targets, T learningRate) Performs a single training step using MSE loss.
Tensor<T> Forward(Tensor<T> features) Performs the forward pass to get predictions (per member).
Tensor<T> Predict(Tensor<T> features) Predicts values (averaged across ensemble members).
ValueTuple<Tensor<T>, Tensor<T>> PredictWithUncertainty(Tensor<T> features) Predicts values with uncertainty estimates.
void ResetState() Resets internal state.
void UpdateParameters(T learningRate) Updates all parameters including the regression head.