exponential_sample_weight#
- openstef_models.transforms.general.sample_weighter.exponential_sample_weight(x: ndarray, scale_percentile: int = 95, exponent: float = 1.0, floor: float = 0.1) ndarray[source]#
Calculate exponentially-scaled sample weights from target values.
Normalizes values relative to a high percentile, applies exponential transformation, and clips to a minimum floor. This creates weights that emphasize high-value samples while ensuring all samples contribute.
- Parameters:
x (ndarray) – Array of target values to compute weights from.
scale_percentile (int) – Percentile used as normalization reference (0-100). Values are divided by this percentile before scaling.
exponent (float) – Power to raise normalized values to. Controls emphasis strength: - 0: Uniform weights (all 1.0) - 1: Linear scaling proportional to values - >1: Stronger emphasis on high values
floor (float) – Minimum weight value. Ensures low-value samples still contribute.
- Returns:
Array of weights in range [floor, 1.0] with same shape as input.
- Return type:
Note
The function uses absolute values throughout, so negative inputs are weighted by their magnitude.