diff --git a/Scripts/downscale.sh b/Scripts/downscale.sh index 54c44a88ee36a55b65f87f87846b38b25d3a1e59..dde1a3b6c71d9356a7f2b2de5ef9779d02d94a59 100644 --- a/Scripts/downscale.sh +++ b/Scripts/downscale.sh @@ -5,7 +5,7 @@ conda activate climax cd ~/git/climax # wet day thresholds to test -WET_DAY_THRESHOLDS=(0, 0.5, 1, 2, 3, 5) +WET_DAY_THRESHOLDS=(0 0.5 1 2 3 5) for w in ${WET_DAY_THRESHOLDS[@]}; do # change wet day threshold in configuration diff --git a/climax/core/loss.py b/climax/core/loss.py index 8895ab177a64c54ac1e4cd72f48f071f1def4deb..dffbb6f256817b149bdc147a4233fcd4653335df 100644 --- a/climax/core/loss.py +++ b/climax/core/loss.py @@ -48,7 +48,7 @@ class L1Loss(NaNLoss): return F.l1_loss(y_pred[mask], y_true[mask], reduction=self.reduction) -class BernoulliLoss(NaNLoss): +class BernoulliGammaLoss(NaNLoss): def __init__(self, size_average=None, reduce=None, reduction='mean', min_amount=0): @@ -57,13 +57,6 @@ class BernoulliLoss(NaNLoss): # minimum amount of precipitation to be classified as precipitation self.min_amount = min_amount - -class BernoulliGammaLoss(BernoulliLoss): - - def __init__(self, size_average=None, reduce=None, reduction='mean', - min_amount=0): - super().__init__(size_average, reduce, reduction) - def forward(self, y_pred, y_true): # convert to float32 @@ -111,12 +104,15 @@ class BernoulliGammaLoss(BernoulliLoss): return p * np.exp(shape) * np.exp(scale) -class BernoulliGenParetoLoss(BernoulliLoss): +class BernoulliGenParetoLoss(NaNLoss): def __init__(self, size_average=None, reduce=None, reduction='mean', min_amount=0): super().__init__(size_average, reduce, reduction) + # minimum amount of precipitation to be classified as precipitation + self.min_amount = min_amount + def forward(self, y_pred, y_true): # convert to float32 @@ -157,12 +153,15 @@ class BernoulliGenParetoLoss(BernoulliLoss): return self.reduce(loss) -class BernoulliWeibullLoss(BernoulliLoss): +class BernoulliWeibullLoss(NaNLoss): def __init__(self, size_average=None, reduce=None, reduction='mean', min_amount=0): super().__init__(size_average, reduce, reduction) + # minimum amount of precipitation to be classified as precipitation + self.min_amount = min_amount + def forward(self, y_pred, y_true): # convert to float32