Tinkex.Types.RegularizerOutput (Tinkex v0.3.4)
View SourceOutput metrics from a single regularizer computation.
This struct captures both the loss contribution and optional gradient tracking information for monitoring regularizer dynamics.
Fields
:name- Regularizer name (matches RegularizerSpec.name):value- Raw loss value before weighting:weight- Weight applied to the loss:contribution- Weighted contribution:weight * value:grad_norm- L2 norm of gradients (when tracking enabled):grad_norm_weighted- Weighted gradient norm:weight * grad_norm:custom- Custom metrics returned by the regularizer function
Examples
%RegularizerOutput{
name: "l1_sparsity",
value: 22.4,
weight: 0.01,
contribution: 0.224,
grad_norm: 7.48,
grad_norm_weighted: 0.0748,
custom: %{"l1_total" => 44.8, "l1_mean" => 22.4}
}
Summary
Functions
Create a RegularizerOutput from computation results.
Types
Functions
@spec from_computation( name :: String.t(), loss_value :: float(), weight :: float(), custom_metrics :: map() | nil, grad_norm :: float() | nil ) :: t()
Create a RegularizerOutput from computation results.
Parameters
name- Regularizer identifierloss_value- Raw loss value (before weighting)weight- Weight multipliercustom_metrics- Map of custom metrics (or nil)grad_norm- L2 norm of gradients (optional)
Examples
RegularizerOutput.from_computation("l1", 22.4, 0.01, %{"l1_mean" => 22.4}, 7.48)