TabNetBase<T>
Base Classes · AiDotNet.NeuralNetworks.Tabular
Base implementation of the TabNet architecture for attentive interpretable tabular learning.
Known derived types: TabNetClassifier<T>, TabNetRegression<T>
For Beginners
TabNet is a neural network designed specifically for tables of data (like spreadsheets or databases). Unlike traditional neural networks that process all features at once, TabNet makes decisions in steps:
- Step 1: “Which features should I look at first?”
- Selects a subset of features using sparse attention
- Processes those features through the Feature Transformer
- Step 2: “Based on what I learned, which features next?”
- Uses information from Step 1 to select new features
- Features used before are less likely to be selected again
- Steps 3, 4, …: Continue refining the decision
At each step, TabNet accumulates knowledge that gets combined into the final output.
This approach provides several benefits:
- Interpretability: You can see which features were selected at each step
- Feature Selection: Automatically ignores irrelevant features
- Efficiency: Doesn’t need to process all features for every prediction
- Performance: Often matches or beats gradient boosting on tabular data
How It Works
TabNet is a deep learning architecture specifically designed for tabular data. It uses sequential attention to choose which features to reason from at each decision step, enabling both high performance and interpretability.
Reference: “TabNet: Attentive Interpretable Tabular Learning” (Arik & Pfister, AAAI 2021)
Properties
| Property | Summary |
|---|---|
long ParameterCount { get; } |
Gets the total number of trainable parameters. |
Methods
| Method | Summary |
|---|---|
IReadOnlyList<Tensor<T>> GetStepAttentionMasks() |
Gets the attention masks from each decision step. |
T ComputeSparsityLoss() |
Computes the sparsity regularization loss. |
Tensor<T> Forward(Tensor<T> input) |
Performs the forward pass through the TabNet encoder. |
Tensor<T> GetFeatureImportance() |
Gets the feature importance from all decision steps. |
Vector<T> GetParameters() |
Gets all trainable parameters. |
void ResetState() |
Resets the internal state. |
void SetParameters(Vector<T> parameters) |
Sets the trainable parameters. |
void SetTrainingMode(bool isTraining) |
Sets training mode. |
void UpdateParameters(T learningRate) |
Updates parameters using the specified learning rate. |