sup3r.utilities.loss_metrics.GeothermalPositiveTemperatureGradientLoss#
- class GeothermalPositiveTemperatureGradientLoss(depths=range(0, 8000, 1000), temperature_prefix='t')[source]#
Bases:
Sup3rLossPositive geothermal gradient loss
This loss applies the positive-gradient regularization described in [1]. It penalizes negative vertical temperature gradients so predicted temperature increases with depth. Temperature features are expected in C and named
<temperature_prefix>_<depth>m(e.g. “t_2000m”).References
Initialize the positive temperature-gradient loss
- Parameters:
depths (iterable of int, optional) – Depth levels in m used to assemble temperature channels. At least two depths are required.
temperature_prefix (str, optional) – Prefix used for temperature channels in C. Expected feature names are
<temperature_prefix>_<depth>m.
Methods
call(y_true, y_pred)Invokes the Loss instance.
from_config(config)Instantiates a Loss from its config (output of get_config()).
Returns the config dictionary for a Loss instance.
Attributes
LOSS_METRIC- __call__(__, x_gen)[source]#
Evaluate the positive temperature-gradient loss
- Parameters:
x_true (tf.tensor) – Ground truth data (unused).
x_gen (tf.tensor) – Synthetic generator output used to compute vertical temperature gradients. The feature axis must contain temperature channels in C. Shape must be either: (n_observations, spatial_1, spatial_2, features) or (n_observations, spatial_1, spatial_2, temporal, features)
- Returns:
tf.tensor – 0D tensor loss value
- abstract call(y_true, y_pred)#
Invokes the Loss instance.
- Args:
- y_true: Ground truth values. shape = [batch_size, d0, .. dN],
except sparse loss functions such as sparse categorical crossentropy where shape = [batch_size, d0, .. dN-1]
y_pred: The predicted values. shape = [batch_size, d0, .. dN]
- Returns:
Loss values with the shape [batch_size, d0, .. dN-1].
- classmethod from_config(config)#
Instantiates a Loss from its config (output of get_config()).
- Args:
config: Output of get_config().
- Returns:
A Loss instance.
- get_config()#
Returns the config dictionary for a Loss instance.