HyperbolicLinearLayer<T>

Layers · AiDotNet.NeuralNetworks.Layers

Represents a fully connected layer operating in hyperbolic (Poincare ball) space.

Inheritance: LayerBase<T> → HyperbolicLinearLayer<T>

Implements: IShapeContract

For Beginners

This layer works in hyperbolic space instead of flat Euclidean space.

Benefits of hyperbolic layers:

  • Naturally represents hierarchical data (trees, graphs, taxonomies)
  • Can embed large hierarchies with low distortion
  • Fewer dimensions needed for complex hierarchical structures

The layer uses the Poincare ball model where all points are inside a unit ball. Points near the center are “higher” in the hierarchy, points near the edge are “lower”.

How It Works

A hyperbolic linear layer performs linear transformations in hyperbolic space using Mobius operations. This is particularly useful for learning hierarchical representations where tree-like structures need to be embedded.

Constructors

Constructor Summary
HyperbolicLinearLayer(int inputFeatures, int outputFeatures, double curvature, IActivationFunction<T> activationFunction) Initializes a new instance of the HyperbolicLinearLayer.

Properties

Property Summary
bool SupportsTraining { get; } Gets whether this layer supports training.
int InputFeatures { get; } Gets the number of input features.
int OutputFeatures { get; } Gets the number of output features.

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) Performs the forward pass through the layer.
IReadOnlyList<Tensor<T>> GetTrainableParameters() Returns all trainable parameter tensors marked with [TrainableParameter].
void ClearGradients() Resets the internal state of the layer.
void ResetState()
void SetTrainableParameters(IReadOnlyList<Tensor<T>> parameters) Replaces trainable parameter tensors (e.g., with ParameterBuffer views).
void UpdateParameters(T learningRate)
void ZeroGrad() Clears all gradient fields discovered by convention ({paramName}Gradient).