ColumnEmbedding<T>

Models & Types · AiDotNet.NeuralNetworks.Tabular

Column (positional) embedding for tabular transformers like TabTransformer.

For Beginners

Column embeddings help the model understand:

  • “This is feature #1 (age)”
  • “This is feature #2 (income)”

Without column embeddings, the model wouldn’t know which feature is which after the attention layers mix them together.

How It Works

Column embeddings provide position information to the transformer, telling it which column/feature each embedding came from. This is analogous to positional encodings in NLP transformers.

Constructors

Constructor Summary
ColumnEmbedding(int numColumns, int embeddingDim, bool learnable, double initScale) Initializes column embeddings.

Properties

Property Summary
int EmbeddingDim { get; } Gets the embedding dimension.
int NumColumns { get; } Gets the number of columns.
long ParameterCount { get; } Gets the number of parameters (0 if using sinusoidal).

Methods

Method Summary
Tensor<T> AddColumnEmbeddings(Tensor<T> featureEmbeddings) Adds column embeddings to feature embeddings.
Vector<T> GetColumnEmbedding(int columnIndex) Gets the column embedding for a specific column.
void ResetGradients() Zeros all stored gradients.
void UpdateParameters(T learningRate) Updates embeddings via gradient descent using the gradients computed by Backward.