TabTransformerClassifier<T>

Models & Types ยท AiDotNet.NeuralNetworks.Tabular

TabTransformer implementation for classification tasks.

Inheritance: TabTransformerBase<T> โ†’ TabTransformerClassifier<T>

For Beginners

Use TabTransformer for classification when:

  • You have important categorical features (like sector, region, category)
  • You believe there are interactions between categorical features
  • You want the model to learn these interactions automatically

Example:

How It Works

TabTransformerClassifier applies transformer attention to categorical features for multi-class classification. Numerical features are concatenated after the categorical embeddings are transformed.

Constructors

Constructor Summary
TabTransformerClassifier(int numNumericalFeatures, int numClasses, TabTransformerOptions<T> options) Initializes a new instance of the TabTransformerClassifier class.

Properties

Property Summary
int NumClasses { get; } Gets the number of output classes.

Methods

Method Summary
T ComputeAccuracy(Tensor<T> numericalFeatures, Vector<int> targets, Matrix<int> categoricalIndices) Computes classification accuracy.
T ComputeCrossEntropyLoss(Tensor<T> probabilities, Vector<int> targets) Computes the cross-entropy loss.
T TrainStep(Tensor<T> numericalFeatures, Vector<int> targets, T learningRate, Matrix<int> categoricalIndices) Performs a single training step.
Tensor<T> Forward(Tensor<T> numericalFeatures, Matrix<int> categoricalIndices) Performs the forward pass to get class logits.
Tensor<T> PredictProbabilities(Tensor<T> numericalFeatures, Matrix<int> categoricalIndices) Predicts class probabilities using softmax.
Vector<int> Predict(Tensor<T> numericalFeatures, Matrix<int> categoricalIndices) Predicts the most likely class for each sample.
void ResetState() Resets internal state.
void UpdateParameters(T learningRate) Updates all parameters.