TabTransformerRegression<T>

Models & Types · AiDotNet.NeuralNetworks.Tabular

TabTransformer implementation for regression tasks.

Inheritance: TabTransformerBase<T> → TabTransformerRegression<T>

For Beginners

Use TabTransformer for regression when:

  • You have important categorical features
  • You believe there are interactions between categorical features
  • You want to predict continuous values (prices, amounts, etc.)

Example:

How It Works

TabTransformerRegression applies transformer attention to categorical features for predicting continuous values. Numerical features are concatenated after the categorical embeddings are transformed.

Constructors

Constructor Summary
TabTransformerRegression(int numNumericalFeatures, int outputDimension, TabTransformerOptions<T> options) Initializes a new instance of the TabTransformerRegression class.

Properties

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

Methods

Method Summary
T ComputeMAELoss(Tensor<T> predictions, Tensor<T> targets) Computes the Mean Absolute Error loss.
T ComputeMSELoss(Tensor<T> predictions, Tensor<T> targets) Computes the Mean Squared Error loss.
T ComputeR2Score(Tensor<T> numericalFeatures, Tensor<T> targets, Matrix<int> categoricalIndices) Computes the R² score.
T ComputeRMSE(Tensor<T> numericalFeatures, Tensor<T> targets, Matrix<int> categoricalIndices) Computes the Root Mean Squared Error.
T TrainStep(Tensor<T> numericalFeatures, Tensor<T> targets, T learningRate, Matrix<int> categoricalIndices) Performs a single training step.
Tensor<T> Forward(Tensor<T> numericalFeatures, Matrix<int> categoricalIndices) Performs the forward pass to get predictions.
Tensor<T> Predict(Tensor<T> numericalFeatures, Matrix<int> categoricalIndices) Makes predictions (alias for Forward).
void ResetState() Resets internal state.
void UpdateParameters(T learningRate) Updates all parameters.