TabNet<T>
Models & Types · AiDotNet.Finance.Risk
TabNet model for tabular data learning, combining tree-based interpretability with deep learning performance.
Inheritance: NeuralNetworkBase<T> → FinancialModelBase<T> → RiskModelBase<T> → TabNet<T>
For Beginners
TabNet is designed specifically for data that comes in tables (rows and columns), like spreadsheets or databases. Traditional neural networks struggle with this kind of data compared to decision trees (like XGBoost). TabNet tries to get the best of both worlds: the accuracy of trees and the end-to-end learning of neural networks.
Example
// Define architecture for tabular risk prediction (50 features, single risk score)
var architecture = new NeuralNetworkArchitecture<double>(
inputType: InputType.OneDimensional,
taskType: NeuralNetworkTaskType.Regression,
inputSize: 50, outputSize: 1);
// Training mode: attentive feature selection with sequential decision steps
var model = new TabNet<double>(architecture);
// Parameterless constructor with default 50-feature regression architecture
var defaultModel = new TabNet<double>();
Constructors
| Constructor | Summary |
|---|---|
TabNet() |
Initializes a new instance with default architecture settings. |
TabNet(NeuralNetworkArchitecture<T> architecture, TabNetOptions<T> options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction) |
|
TabNet(NeuralNetworkArchitecture<T> architecture, string onnxModelPath, TabNetOptions<T> options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction) |
Initializes a new instance of the TabNet model from a pretrained ONNX model. |
Methods
| Method | Summary |
|---|---|
T CalculateRisk(Tensor<T> input) |
Calculates risk using the TabNet model. |
Tensor<T> AdjustForRisk(Tensor<T> action, T riskBudget) |
Adjusts action for risk. |