SampleWeighter#

class openstef_beam.metrics.metrics_helpers.SampleWeighter(*, a_min: float = 0.1, a_max: float = 1.0, exponent: float = 1.0)[source]

Bases: BaseConfig

Weights samples by their magnitude relative to a scale, clipped to [a_min, a_max].

Parameters:
a_min: float
a_max: float
exponent: float
calculate_weights(values: NDArray[floating], scale: float | NDArray[floating]) → NDArray[floating][source]

Calculate weights for values given a scalar or per-sample scale.

Parameters:
Return type:

NDArray[floating]

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': False, 'extra': 'ignore', 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].