ScalarWeighting#
Module for the Scalar Weighting.
- class ScalarWeighting(weights)[source]#
Bases:
BaseWeightingWeighting strategy based on fixed scalar coefficients.
This scheme assigns a constant multiplicative weight to each loss term, without adapting over time. The same weight can be applied to all terms, or distinct weights can be specified for individual conditions.
Initialization of the
ScalarWeightingclass.- Parameters:
weights (float | int | dict) – The scalar weights associated with each loss term. It can be provided either as a single numeric value or as a dictionary. If a scalar is given, the same weight is applied to all loss terms. If a dictionary is provided, its keys represent the loss identifiers (e.g., conditions) and its values specify the corresponding weights. Loss terms not explicitly defined in the dictionary are assigned a default weight of
1.- Raises:
ValueError – If the input weights are neither numeric nor a dictionary.