TabPFNRegression<T>

Models & Types · AiDotNet.NeuralNetworks.Tabular

TabPFN implementation for regression tasks.

Inheritance: TabPFNBase<T> → TabPFNRegression<T>

For Beginners

TabPFN regression works similarly to classification:

  1. First, call SetContext() with your training data and target values
  2. Then, call Predict() with test data
  3. The model uses attention to “learn” the regression pattern from context

Example:

How It Works

TabPFNRegression uses in-context learning for tabular regression. It takes training data as context and makes predictions on test data in a single forward pass using attention mechanisms.

Constructors

Constructor Summary
TabPFNRegression(int numNumericalFeatures, int outputDimension, TabPFNOptions<T> options) Initializes a new instance of the TabPFNRegression 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 (coefficient of determination).
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 (for fine-tuning).
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).
Tensor<T> PredictEnsemble(Tensor<T> numericalFeatures, int numEnsembles, Matrix<int> categoricalIndices) Predicts with ensemble averaging over multiple permutations.
void ResetState() Resets internal state.
void SetContext(Tensor<T> features, Tensor<T> targets) Sets the context (training) data for in-context learning.
void UpdateParameters(T learningRate) Updates all parameters.