From 04805dcc0ad371cfc66c5301bf077ad02027b11d Mon Sep 17 00:00:00 2001 From: "Daniel.Frisinghelli" <daniel.frisinghelli@eurac.edu> Date: Wed, 13 Oct 2021 18:16:04 +0200 Subject: [PATCH] Bash compliance. --- Scripts/downscale.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Scripts/downscale.sh b/Scripts/downscale.sh index 385ae3e..27e4473 100644 --- a/Scripts/downscale.sh +++ b/Scripts/downscale.sh @@ -5,7 +5,7 @@ conda activate climax cd ~/git/climax # loss functions -LOSS=(BernoulliGammaLoss(min_amount=1) BernoulliWeibullLoss(min_amount=1) L1Loss() MSELoss()) +LOSS=(L1Loss BernoulliGammaLoss BernoulliWeibullLoss MSELoss) # wet day thresholds to test # WET_DAY_THRESHOLDS=(0 0.5 1 2 3 5) @@ -15,13 +15,18 @@ LAMBDA=(0 0.0000001 0.000001 0.00001 0.0001 0.001 0.01 0.1 1) # iterate over loss functions for loss in ${LOSS[@]}; do - # change loss function in configuration - sed -i "s/LOSS\s*=.*/LOSS=$loss/" ./climax/main/config.py + # change loss function in configuration + if [ "$loss" = "L1Loss" ] || [ "$loss" = "MSELoss" ]; then + sed -i "s/LOSS\s*=.*/LOSS=$loss()/" ./climax/main/config.py + else + sed -i "s/LOSS\s*=.*/LOSS=$loss(min_amount=1)/" ./climax/main/config.py + fi + # iterate over weight decay values for lambda in ${LAMBDA[@]}; do # change weight regularization in configuration - sed -i "s/LAMBDA\s*=.*/LAMBDA=$lambda)/" ./climax/main/config.py + sed -i "s/LAMBDA\s*=.*/LAMBDA=$lambda/" ./climax/main/config.py # run downscaling # python climax/main/downscale.py -- GitLab