TabROptions<T>

Options & Configuration · AiDotNet.Models.Options

Configuration options for TabR, a retrieval-augmented model for tabular data.

Inheritance: ModelOptions → NeuralNetworkOptions → ModelHyperparameterOptions → FinancialNeuralNetworkOptions → RiskModelOptions<T> → TabROptions<T>

For Beginners

TabR is like a student who looks at similar past problems to help solve a new one.

How it works:

  1. Encode: Convert features to a learned representation
  2. Retrieve: Find the K most similar training samples
  3. Attend: Use attention to aggregate information from neighbors
  4. Predict: Make a prediction using both query and neighbor information

Why this works well for tabular data:

  • Tabular data often has local structure (similar inputs → similar outputs)
  • Retrieval adds “memory” without needing to memorize in network weights
  • Combines strengths of neural networks (feature learning) and k-NN (locality)
  • Naturally handles rare patterns by finding similar examples

Example usage:

How It Works

TabR combines neural networks with instance-based learning by retrieving similar training examples and using their information to help make predictions. It encodes both the query sample and retrieved neighbors, then aggregates the information using attention.

Reference: “TabR: Tabular Deep Learning Meets Nearest Neighbors” (2023)

Constructors

Constructor Summary
TabROptions()

Properties

Property Summary
ActivationFunction Activation { get; set; } Gets or sets the activation inside every block, inside the value MLP T and in the head: the reference implementation’s activation.
BiasMode ValueOutputBiasMode { get; set; } Gets or sets whether the last linear layer of the value MLP T carries a bias.
TabRNormalization Normalization { get; set; } Gets or sets the normalization layer of the blocks, the mixer and the head: the reference implementation’s normalization.
TabRNumericEmbedding NumericEmbedding { get; set; } Gets or sets how the numeric features are embedded before the encoder: the reference implementation’s num_embeddings.
bool IncludeNeighborTargets { get; set; } Gets or sets whether to include target values of retrieved neighbors.
bool LiteNumericEmbedding { get; set; } Gets or sets whether the periodic embedding’s linear map is shared by every feature: the reference lite.
bool NormalizeEmbeddings { get; set; } Gets or sets whether to normalize embeddings for retrieval.
bool? MixerNormalization { get; set; } Gets or sets whether the encoder output is normalized before the key projection K: the reference implementation’s mixer_normalization.
double BlockOutputDropoutRate { get; set; } Gets or sets the dropout rate on the output of every encoder and predictor block, before the residual add: the reference implementation’s dropout1.
double BlockWidthMultiplier { get; set; } Gets or sets the hidden width of every block and of the value MLP T as a multiple of EmbeddingDimension: the reference implementation’s d_multiplier.
double ContextDropoutRate { get; set; } Gets or sets the dropout rate on the retrieval weights: the reference implementation’s context_dropout.
double DropoutRate { get; set; } Gets or sets the dropout rate after every hidden activation: the reference implementation’s dropout0.
double FrequencyInitScale { get; set; } Gets or sets the standard deviation of the initial frequencies of the periodic embedding: the reference frequency_scale (frequency_init_scale in rtdl_num_embeddings).
double RetrievalTemperature { get; set; } Gets or sets the temperature for retrieval softmax.
double WeightDecay { get; set; } Gets or sets the weight decay coefficient.
int EmbeddingDimension { get; set; } Gets or sets the width of every hidden representation: the reference implementation’s d_main.
int EncoderNumBlocks { get; set; } Gets or sets the number of residual blocks after the encoder’s first linear map: the reference implementation’s encoder_n_blocks.
int NumFrequencies { get; set; } Gets or sets the number of learned frequencies per feature of the periodic embedding: the reference n_frequencies.
int NumLayers { get; set; } Gets or sets the number of hidden layers of TabRNetwork’s retrieval-free layer stack.
int NumNeighbors { get; set; } Gets or sets the number of nearest neighbors to retrieve.
int NumericEmbeddingDimension { get; set; } Gets or sets the width of each feature’s embedding: the reference d_embedding.
int PredictorNumBlocks { get; set; } Gets or sets the number of residual blocks between the retrieval module and the prediction head: the reference implementation’s predictor_n_blocks.

Methods

Method Summary
TabROptions<T> Clone() Creates a copy of the options.