igl.types
Public Protocols, enum.StrEnum classes, and Literal companions.
Protocols
igl.types.EncoderProtocol
igl.types.OperatorFn
Bases: Protocol
Log-space kernel operator.
Given a distance tensor d and a width tensor sigma of broadcastable
shapes, returns (log_abs, sign) so the multi-scale product kernel can be
accumulated in log-space while tracking signs for oscillatory operators.
igl.types.LossStrategy
Bases: Protocol
Pluggable loss for :class:igl.MatryoshkaTrainer.
Implementations supply task-specific targets (one-hot encoding,
pass-through, log-Euclidean SPD targets, …), the loss to minimise, a
scalar metric for early-stopping decisions, and — separately — a
curve score used by :func:igl.eval_dimension_curve to make
dimension curves informative (e.g. error rate for classifiers, which
doesn't saturate the way cross-entropy does).
Attributes:
| Name | Type | Description |
|---|---|---|
higher_is_better |
bool
|
|
igl.types.MatryoshkaSampler
igl.types.ExtraLoss
Bases: Protocol
Optional regularizer that contributes a scalar term to the training loss.
Used by :class:igl.MatryoshkaTrainer to fold in geometry-specific
penalties (e.g. the SPD orthogonality penalty from
:class:igl.spd.OrthogonalityPenalty) without coupling the trainer to
that geometry.
The trainer calls the extra loss once per batch (subject to
:attr:every), adds weight * contribution to the task loss, and
backpropagates through everything in one go. Implementations may return
None to skip the contribution for this step (useful when the
regularizer is only defined for k ≥ 2, for example).
Attributes:
| Name | Type | Description |
|---|---|---|
weight |
float
|
Multiplier applied to the returned tensor before adding to the task loss. |
every |
int
|
Call frequency in batches (1 = every batch). |
String enums
igl.types.OperatorName
igl.types.SamplingMode
igl.types.NormalizeMode
Bases: StrEnum
Row-wise normalization applied to the design matrix Φ before lstsq.
NONE: identity.SOFTMAX: row-softmax.L2: L2-normalise each row.NW: Nadaraya–Watson (divide each row by its sum, with a small epsilon).