InteractingLayer<T>
Layers · AiDotNet.NeuralNetworks.Layers
Interacting Layer for AutoInt architecture.
Inheritance: LayerBase<T> → InteractingLayer<T>
Implements: IShapeContract
For Beginners
The interacting layer helps discover relationships between features:
- 1st layer: “age relates to income”
- 2nd layer: “age + income together relate to credit score”
- 3rd layer: “age + income + credit score relate to loan approval”
Each layer builds on the previous to capture more complex patterns. The attention mechanism learns which feature combinations are important.
How It Works
The interacting layer is the core component of AutoInt that learns high-order feature interactions through multi-head self-attention. Each layer captures different orders of interactions between features.
Constructors
| Constructor | Summary |
|---|---|
InteractingLayer(int embeddingDim, int numHeads, int? attentionDim, bool useResidual, double initScale) |
Initializes an interacting layer. |
Properties
| Property | Summary |
|---|---|
bool SupportsTraining { get; } |
Methods
| Method | Summary |
|---|---|
Dictionary<string, string> GetParameterRoles() |
Returns parameter roles for per-role optimizer configuration (e.g., weight decay exemption for biases). |
IReadOnlyList<OutputAxisContract> OutputAxesFor(int inputRank) |
Derived from this type’s [TensorLayout] declarations. |
IReadOnlyList<Tensor<T>> GetTrainableParameters() |
Returns all trainable parameter tensors marked with [TrainableParameter]. |
Tensor<T> GetAttentionScores() |
Gets attention scores for interpretability. |
void ResetState() |
Resets internal state. |
void SetTrainableParameters(IReadOnlyList<Tensor<T>> parameters) |
Replaces trainable parameter tensors (e.g., with ParameterBuffer views). |
void UpdateParameters(T learningRate) |
Updates parameters using gradient descent. |
void ZeroGrad() |
Clears all gradient fields discovered by convention ({paramName}Gradient). |