Regression & MLR¶
Single-layer hyperbolic classifiers (multinomial logistic regression heads). For which head to pair with which backbone, see the NN Layers guide.
Two decision geometries are available: point-to-hyperplane heads
(Ganea/Shimizu/Bdeir lineage — the HypRegression* and FGGLorentzMLR layers) and
point-to-horosphere Busemann heads (Chen et al. 2026), whose logits are
\(u_k(x) = -\alpha_k B^{v_k}(x) + b_k\) from the closed-form Busemann function
(Hyperboloid.busemann / Poincare.busemann).
Poincaré¶
hyperbolix.nn_layers.HypRegressionPoincare ¶
HypRegressionPoincare(
manifold_module: Poincare,
in_dim: int,
out_dim: int,
*,
rngs: Rngs,
input_space: str = "manifold",
clamping_factor: float = 1.0,
smoothing_factor: float = 50.0,
curvature: float | Callable[[], Any] = 1.0,
param_dtype: DTypeLike = jnp.float32,
)
Bases: Module
Hyperbolic Neural Networks multinomial linear regression layer (Poincaré ball model).
Computation steps: 0) Project the input tensor onto the manifold (optional) 1) Compute the multinomial linear regression score(s)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manifold_module
|
object
|
Class-based Poincare manifold instance |
required |
in_dim
|
int
|
Dimension of the input space |
required |
out_dim
|
int
|
Dimension of the output space |
required |
rngs
|
Rngs
|
Random number generators for parameter initialization |
required |
input_space
|
str
|
Type of the input tensor, either 'tangent' or 'manifold' (default: 'manifold'). Note: This is a static configuration - changing it after initialization requires recompilation. |
'manifold'
|
clamping_factor
|
float
|
Clamping factor for the multinomial linear regression output (default: 1.0) |
1.0
|
smoothing_factor
|
float
|
Smoothing factor for the multinomial linear regression output (default: 50.0) |
50.0
|
curvature
|
float or callable
|
Curvature tag for the manifold-valued |
1.0
|
param_dtype
|
DTypeLike
|
Storage dtype of the trainable parameters (default: jnp.float32).
Compute precision of manifold operations is set by |
float32
|
Notes
JIT Compatibility: This layer is designed to work with nnx.jit. Configuration parameters (input_space, clamping_factor, smoothing_factor) are treated as static and will be baked into the compiled function.
References
Ganea Octavian, Gary Bécigneul, and Thomas Hofmann. "Hyperbolic neural networks." Advances in neural information processing systems 31 (2018).
Source code in hyperbolix/nn_layers/poincare_regression.py
__call__ ¶
Forward pass through the hyperbolic regression layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Array of shape (batch, in_dim)
|
Input tensor where the hyperbolic_axis is last |
required |
c
|
float
|
Manifold curvature (default: 1.0) |
1.0
|
Returns:
| Name | Type | Description |
|---|---|---|
res |
Array of shape (batch, out_dim)
|
Multinomial linear regression scores |
Source code in hyperbolix/nn_layers/poincare_regression.py
hyperbolix.nn_layers.HypRegressionPoincarePP ¶
HypRegressionPoincarePP(
manifold_module: Poincare,
in_dim: int,
out_dim: int,
*,
rngs: Rngs,
input_space: str = "manifold",
clamping_factor: float = 1.0,
smoothing_factor: float = 50.0,
param_dtype: DTypeLike = jnp.float32,
)
Bases: Module
Hyperbolic Neural Networks ++ multinomial linear regression layer (Poincaré ball model).
Computation steps: 0) Project the input tensor onto the manifold (optional) 1) Compute the multinomial linear regression score(s)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manifold_module
|
object
|
Class-based Poincare manifold instance |
required |
in_dim
|
int
|
Dimension of the input space |
required |
out_dim
|
int
|
Dimension of the output space |
required |
rngs
|
Rngs
|
Random number generators for parameter initialization |
required |
input_space
|
str
|
Type of the input tensor, either 'tangent' or 'manifold' (default: 'manifold'). Note: This is a static configuration - changing it after initialization requires recompilation. |
'manifold'
|
clamping_factor
|
float
|
Clamping factor for the multinomial linear regression output (default: 1.0) |
1.0
|
smoothing_factor
|
float
|
Smoothing factor for the multinomial linear regression output (default: 50.0) |
50.0
|
param_dtype
|
DTypeLike
|
Storage dtype of the trainable parameters (default: jnp.float32).
Compute precision of manifold operations is set by |
float32
|
Notes
JIT Compatibility: This layer is designed to work with nnx.jit. Configuration parameters (input_space, clamping_factor, smoothing_factor) are treated as static and will be baked into the compiled function.
References
Shimizu Ryohei, Yusuke Mukuta, and Tatsuya Harada. "Hyperbolic neural networks++." arXiv preprint arXiv:2006.08210 (2020).
Source code in hyperbolix/nn_layers/poincare_regression.py
__call__ ¶
Forward pass through the HNN++ hyperbolic regression layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Array of shape (batch, in_dim)
|
Input tensor where the hyperbolic_axis is last |
required |
c
|
float
|
Manifold curvature (default: 1.0) |
1.0
|
Returns:
| Name | Type | Description |
|---|---|---|
res |
Array of shape (batch, out_dim)
|
Multinomial linear regression scores |
Source code in hyperbolix/nn_layers/poincare_regression.py
hyperbolix.nn_layers.HypRegressionPoincareBusemann ¶
HypRegressionPoincareBusemann(
manifold_module: Poincare,
in_dim: int,
out_dim: int,
*,
rngs: Rngs,
input_space: str = "manifold",
param_dtype: DTypeLike = jnp.float32,
)
Bases: Module
Busemann MLR classification head (Poincaré ball model).
Computes per-class logits u_k(x) = -alpha_k·B^{v_k}(x) + b_k from the Poincaré Busemann
function (point-to-horosphere distance), returning Euclidean logits — not manifold points.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manifold_module
|
Poincare
|
Class-based Poincaré manifold instance. |
required |
in_dim
|
int
|
Input spatial dimension (the ball has no time component). |
required |
out_dim
|
int
|
Number of classes. |
required |
rngs
|
Rngs
|
Random number generators for parameter initialization. |
required |
input_space
|
str
|
|
'manifold'
|
param_dtype
|
DTypeLike
|
Storage dtype of the trainable parameters (default: jnp.float32). Compute precision
of manifold operations is set by |
float32
|
References
Chen, Schölkopf, and Sebe. "Hyperbolic Busemann Neural Networks." 2026, Sec. 3.
Source code in hyperbolix/nn_layers/busemann_regression.py
__call__ ¶
Forward pass returning Euclidean Busemann logits, shape (batch, out_dim).
Source code in hyperbolix/nn_layers/busemann_regression.py
Hyperboloid¶
FGGLorentzMLR is the FGG-family head (Klis et al. 2026); pair it with an FGG linear
stack.
hyperbolix.nn_layers.HypRegressionHyperboloid ¶
HypRegressionHyperboloid(
manifold_module: Hyperboloid,
in_dim: int,
out_dim: int,
*,
rngs: Rngs,
input_space: str = "manifold",
clamping_factor: float = 1.0,
smoothing_factor: float = 50.0,
param_dtype: DTypeLike = jnp.float32,
)
Bases: Module
Fully Hyperbolic Convolutional Neural Networks multinomial linear regression layer (Hyperboloid model).
Computation steps: 0) Project the input tensor onto the manifold (optional) 1) Compute the multinomial linear regression score(s)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manifold_module
|
object
|
Class-based Hyperboloid manifold instance |
required |
in_dim
|
int
|
Dimension of the input space |
required |
out_dim
|
int
|
Dimension of the output space |
required |
rngs
|
Rngs
|
Random number generators for parameter initialization |
required |
input_space
|
str
|
Type of the input tensor, either 'tangent' or 'manifold' (default: 'manifold'). Note: This is a static configuration - changing it after initialization requires recompilation. |
'manifold'
|
clamping_factor
|
float
|
Clamping factor for the multinomial linear regression output (default: 1.0) |
1.0
|
smoothing_factor
|
float
|
Smoothing factor for the multinomial linear regression output (default: 50.0) |
50.0
|
param_dtype
|
DTypeLike
|
Storage dtype of the trainable parameters (default: jnp.float32).
Compute precision of manifold operations is set by |
float32
|
Notes
JIT Compatibility: This layer is designed to work with nnx.jit. Configuration parameters (input_space, clamping_factor, smoothing_factor) are treated as static and will be baked into the compiled function.
References
Ahmad Bdeir, Kristian Schwethelm, and Niels Landwehr. "Fully hyperbolic convolutional neural networks for computer vision." arXiv preprint arXiv:2303.15919 (2023).
Source code in hyperbolix/nn_layers/hyperboloid_regression.py
__call__ ¶
Forward pass through the hyperbolic regression layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Array of shape (batch, in_dim)
|
Input tensor where the hyperbolic_axis is last |
required |
c
|
float
|
Manifold curvature (default: 1.0) |
1.0
|
Returns:
| Name | Type | Description |
|---|---|---|
res |
Array of shape (batch, out_dim)
|
Multinomial linear regression scores |
Source code in hyperbolix/nn_layers/hyperboloid_regression.py
hyperbolix.nn_layers.HypRegressionHyperboloidBusemann ¶
HypRegressionHyperboloidBusemann(
manifold_module: Hyperboloid,
in_dim: int,
out_dim: int,
*,
rngs: Rngs,
input_space: str = "manifold",
param_dtype: DTypeLike = jnp.float32,
)
Bases: Module
Busemann MLR classification head (Hyperboloid / Lorentz model).
Computes per-class logits u_k(x) = -alpha_k·B^{v_k}(x) + b_k from the Lorentz Busemann
function (point-to-horosphere distance), returning Euclidean logits — not manifold points.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manifold_module
|
Hyperboloid
|
Class-based Hyperboloid manifold instance. |
required |
in_dim
|
int
|
Input ambient dimension ( |
required |
out_dim
|
int
|
Number of classes. |
required |
rngs
|
Rngs
|
Random number generators for parameter initialization. |
required |
input_space
|
str
|
|
'manifold'
|
param_dtype
|
DTypeLike
|
Storage dtype of the trainable parameters (default: jnp.float32). Compute precision
of manifold operations is set by |
float32
|
Notes
Parameters use the weight-normalization split (kernel directions, log_scale
log-magnitudes alpha = exp(log_scale), bias); see :func:busemann_core.busemann_score.
References
Chen, Schölkopf, and Sebe. "Hyperbolic Busemann Neural Networks." 2026, Sec. 3.
Source code in hyperbolix/nn_layers/busemann_regression.py
__call__ ¶
Forward pass returning Euclidean Busemann logits, shape (batch, out_dim).
Source code in hyperbolix/nn_layers/busemann_regression.py
hyperbolix.nn_layers.FGGLorentzMLR ¶
FGGLorentzMLR(
in_features: int,
num_classes: int,
*,
rngs: Rngs,
reset_params: str = "mlr",
init_bias: float = 0.5,
eps: float = 1e-07,
param_dtype: DTypeLike = jnp.float32,
)
Bases: Module
Fast and Geometrically Grounded Lorentz multinomial logistic regression.
Outputs Euclidean logits (signed scaled distances to hyperplanes) using the
FGG spacelike V construction. Unlike HypRegressionHyperboloid, this layer
uses the distance-to-hyperplane formulation matching the reference fc_mlr
(signed_dist2hyperplanes_scaled_angle).
Forward pass (matching reference fc_mlr): 1. Build V_mink from (z, a) 2. mink = x @ V_mink (Minkowski inner products) 3. logits = asinh(sqrt(c) * mink) / sqrt(c) (signed scaled distances)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_features
|
int
|
Input ambient dimension (D_in + 1), including time component. |
required |
num_classes
|
int
|
Number of output classes. |
required |
rngs
|
Rngs
|
Random number generators for parameter initialization. |
required |
reset_params
|
str
|
Weight initialization scheme for hyperplane normals: |
'mlr'
|
init_bias
|
float
|
Initial value for bias entries (default: 0.5). |
0.5
|
eps
|
float
|
Numerical stability floor (default: 1e-7). |
1e-07
|
param_dtype
|
DTypeLike
|
Storage dtype of the trainable parameters (default: jnp.float32).
Compute precision of manifold operations is set by the manifold's |
float32
|
References
Klis et al. "Fast and Geometrically Grounded Lorentz Neural Networks" (2026), Eq. 23.
Source code in hyperbolix/nn_layers/hyperboloid_regression.py
__call__ ¶
__call__(
x_BAi: Float[Array, "batch in_features"], c: float = 1.0
) -> Float[Array, "batch num_classes"]
Forward pass returning Euclidean logits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_BAi
|
(Array, shape(B, Ai))
|
Input points on the hyperboloid with curvature |
required |
c
|
float
|
Curvature parameter (default: 1.0). |
1.0
|
Returns:
| Name | Type | Description |
|---|---|---|
logits_BK |
(Array, shape(B, K))
|
Euclidean logits (signed scaled distances to hyperplanes). |
Source code in hyperbolix/nn_layers/hyperboloid_regression.py
Proper Velocity¶
HypRegressionPV (Chen et al. 2026, Thm 5.2 / Eq. 19) returns the Euclidean signed
margin to each PV hyperplane — feed to a standard softmax cross-entropy loss.
hyperbolix.nn_layers.HypRegressionPV ¶
HypRegressionPV(
manifold_module: ProperVelocity,
in_dim: int,
out_dim: int,
*,
rngs: Rngs,
input_space: str = "manifold",
clamping_factor: float = 1.0,
smoothing_factor: float = 50.0,
param_dtype: DTypeLike = jnp.float32,
)
Bases: Module
Hyperbolic multinomial logistic regression layer (Proper Velocity model).
Implements Chen et al. 2026, Thm 5.2 / Eq. 19, delegating to
ProperVelocity.compute_mlr. The output is the Euclidean signed margin
to each PV hyperplane and is intended to be consumed by a standard
softmax-cross-entropy classification loss.
Computation steps:
0) Optionally lift tangent-space input via expmap_0.
1) Compute the PV MLR scores via manifold.compute_mlr.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manifold_module
|
ProperVelocity
|
Class-based Proper Velocity manifold instance. |
required |
in_dim
|
int
|
Dimension of the input space. |
required |
out_dim
|
int
|
Dimension of the output space (number of classes). |
required |
rngs
|
Rngs
|
Random number generators for parameter initialization. |
required |
input_space
|
str
|
Type of the input tensor, either 'tangent' or 'manifold' (default: 'manifold'). Note: This is a static configuration — changing it after initialization requires recompilation. |
'manifold'
|
clamping_factor
|
float
|
Clamping factor for the MLR output (default: 1.0). |
1.0
|
smoothing_factor
|
float
|
Smoothing factor for the MLR output (default: 50.0). |
50.0
|
param_dtype
|
DTypeLike
|
Storage dtype of the trainable parameters (default: jnp.float32).
Compute precision of manifold operations is set by |
float32
|
Notes
JIT Compatibility: Configuration parameters (input_space, clamping_factor, smoothing_factor) are treated as static and are baked into the compiled function.
References
Chen et al. "Proper Velocity Neural Networks." ICLR 2026.
Source code in hyperbolix/nn_layers/pv_regression.py
__call__ ¶
Forward pass through the PV regression layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Array of shape (batch, in_dim)
|
Input tensor — PV manifold points or tangent-space vectors. |
required |
c
|
float
|
Manifold curvature (default: 1.0). |
1.0
|
Returns:
| Name | Type | Description |
|---|---|---|
res |
Array of shape (batch, out_dim)
|
MLR logits (Euclidean, suitable for cross-entropy). |
Source code in hyperbolix/nn_layers/pv_regression.py
Example¶
import jax
from flax import nnx
from hyperbolix.nn_layers import HypRegressionPoincare
from hyperbolix.manifolds import Poincare
poincare = Poincare()
head = HypRegressionPoincare(manifold_module=poincare, in_dim=32, out_dim=10, rngs=nnx.Rngs(0))
x = jax.random.normal(jax.random.PRNGKey(1), (64, 32)) * 0.3
x_proj = jax.vmap(poincare.proj, in_axes=(0, None))(x, 1.0)
logits = head(x_proj, c=1.0) # (64, 10)
probs = jax.nn.softmax(logits, axis=-1)