TabDPTNetwork<T>

Models & Types · AiDotNet.NeuralNetworks.Tabular

TabDPT (Tabular Data Pre-Training) neural network for tabular data.

Inheritance: NeuralNetworkBase<T> → TabularNeuralNetworkBase<T> → TabDPTNetwork<T>

For Beginners

TabDPT brings foundation model ideas to tabular data:

Architecture:

  1. Input Projection: Map features to embedding space
  2. Transformer Encoder: Deep self-attention for feature relationships
  3. Context Learning: Learn from in-context examples
  4. Output Head: Task-specific prediction layer

Key insight: By pre-training on many diverse tabular datasets, TabDPT learns patterns that transfer to new datasets, similar to how large language models learn from diverse text.

How It Works

TabDPT is a foundation model approach for tabular data that uses pre-training on diverse datasets to learn transferable representations. This implementation follows the standard neural network architecture pattern with:

  • Proper inheritance from NeuralNetworkBase
  • Layer-based architecture using ILayer components
  • Engine-based tensor operations for CPU/GPU acceleration
  • Full autodiff and JIT compilation support

Reference: “TabDPT: Scaling Tabular Foundation Models on Real Data” (2024)

Example

var architecture = new NeuralNetworkArchitecture<float>(inputFeatures: 8, outputSize: 4);
var options = new TabDPTOptions<double> { NumFeatures = 20, EmbeddingDimension = 128, NumLayers = 12 };
var input = Tensor<float>.CreateRandom(new[] { 1, 20 });
var trainX = Tensor<float>.CreateRandom(4, 8);
var trainY = Tensor<float>.CreateRandom(4, 2);
var result = new AiModelBuilder<float, Tensor<float>, Tensor<float>>()
    .ConfigureModel(new TabDPTNetwork<float>(architecture))
    .Build(trainX, trainY);
var output = result.Predict(input);

Constructors

Constructor Summary
TabDPTNetwork() Initializes a new TabDPT network with the specified architecture.
TabDPTNetwork(NeuralNetworkArchitecture<T> architecture, TabDPTOptions<T> options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction)

Properties

Property Summary
TabDPTOptions<T> Options { get; } Gets the TabDPT-specific options.
int EmbeddingDimension { get; } Gets the embedding dimension.
int NumLayers { get; } Gets the number of transformer layers.

Methods

Method Summary
Dictionary<string, T> GetFeatureImportance()
ModelMetadata<T> GetModelMetadata()