TabNetEncoderLayer<T>

Layers · AiDotNet.NeuralNetworks.Layers

TabNet encoder (Arik & Pfister 2019): a sequential-attention block that produces an aggregated decision representation through several decision steps, each of which selects a sparse subset of features via a learnable mask.

Inheritance: LayerBase<T> → TabNetEncoderLayer<T>

Implements: IShapeContract

How It Works

TabNet is not a feed-forward stack, so the decision-step loop is encapsulated in this single composite layer (held in a model’s Layers list like any other layer). Each decision step:

The feature count is resolved lazily from the first forward input (like DenseLayer), so the layer adapts to the actual fed input width. All sub-layers are registered via RegisterSubLayer so the trainable-parameter walk reaches them and the optimizer updates them; the forward pass is built entirely from tape-recorded Engine ops and sub-layer Forward calls, so gradients flow end-to-end. The decision/attention split uses a constant selection-matrix matmul (tape-safe) rather than a tensor slice. Output: [batch, decisionDim].

Constructors

Constructor Summary
TabNetEncoderLayer(int numFeatures, int decisionDim, int attentionDim, int numSteps, int numSharedLayers, int numStepSpecificLayers, double relaxationFactor, int virtualBatchSize, double momentum, double epsilon) Initializes a new TabNetEncoderLayer.

Properties

Property Summary
bool SupportsTraining { get; }

Methods

Method Summary
Dictionary<string, string> GetParameterRoles() Returns parameter roles for per-role optimizer configuration (e.g., weight decay exemption for biases).
IReadOnlyList<ILayer<T>> GetSubLayers()
IReadOnlyList<OutputAxisContract> OutputAxesFor(int inputRank)
IReadOnlyList<Tensor<T>> GetTrainableParameters() Returns all trainable parameter tensors marked with [TrainableParameter].
void ResetState()
void SetTrainableParameters(IReadOnlyList<Tensor<T>> parameters) Replaces trainable parameter tensors (e.g., with ParameterBuffer views).
void SetTrainingMode(bool isTraining)
void UpdateParameters(T learningRate)
void ZeroGrad() Clears all gradient fields discovered by convention ({paramName}Gradient).