AutoIntNetwork<T>

Models & Types · AiDotNet.NeuralNetworks.Tabular

AutoInt (Automatic Feature Interaction Learning) neural network for tabular data.

Inheritance: NeuralNetworkBase<T> → TabularNeuralNetworkBase<T> → AutoIntNetwork<T>

For Beginners

AutoInt discovers feature interactions automatically:

Architecture:

  1. Feature Embeddings: Each feature gets a learned vector representation
  2. Self-Attention Layers: Features attend to each other to learn interactions
  3. Residual Connections: Preserve individual feature information
  4. MLP Head: Final prediction from interaction-enhanced features

Key insight: Feature interactions (e.g., “age + income” or “city + job”) are often important for predictions. AutoInt learns these automatically through attention, capturing which features should be combined.

Example: In click prediction, “user_age + product_category” might have a strong interaction that AutoInt discovers without manual feature engineering.

How It Works

AutoInt uses multi-head self-attention to automatically learn high-order feature interactions without manual feature engineering. This implementation follows the standard neural network architecture pattern with:

  • Proper inheritance from NeuralNetworkBase
  • Layer-based architecture using ILayer components
  • Engine-based tensor operations for CPU/GPU acceleration
  • Full autodiff and JIT compilation support

Reference: “AutoInt: Automatic Feature Interaction Learning via Self-Attentive Neural Networks” (2018)

Example

var architecture = new NeuralNetworkArchitecture<float>(inputFeatures: 8, outputSize: 4);
var options = new AutoIntOptions<double> { NumFeatures = 20, EmbeddingDimension = 16, NumHeads = 2, NumLayers = 3 };
var input = Tensor<float>.CreateRandom(new[] { 1, 20 });
var trainX = Tensor<float>.CreateRandom(4, 8);
var trainY = Tensor<float>.CreateRandom(4, 2);
var result = new AiModelBuilder<float, Tensor<float>, Tensor<float>>()
    .ConfigureModel(new AutoIntNetwork<float>(architecture))
    .Build(trainX, trainY);
var output = result.Predict(input);

Constructors

Constructor Summary
AutoIntNetwork() Initializes a new AutoInt network with the specified architecture.
AutoIntNetwork(NeuralNetworkArchitecture<T> architecture, AutoIntOptions<T> options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction)

Properties

Property Summary
AutoIntOptions<T> Options { get; } Gets the AutoInt-specific options.
int EmbeddingDimension { get; } Gets the embedding dimension.
int NumHeads { get; } Gets the number of attention heads.
int NumLayers { get; } Gets the number of interacting layers.

Methods

Method Summary
Dictionary<string, T> GetFeatureImportance()
ModelMetadata<T> GetModelMetadata()