USGS-R / river-dl

Deep learning model for predicting environmental variables on river systems
Creative Commons Zero v1.0 Universal
21 stars 15 forks source link

config file option for training rule #113

Closed janetrbarclay closed 2 years ago

janetrbarclay commented 3 years ago

Would it be beneficial to have a setting in config.yml that determines which training rule in the Snakefile is used? Seems easier than having to comment / uncomment each time a switch is made (especially since the config file is likely edited for each run but the Snakefile may not be).

jsadler2 commented 3 years ago

Great idea! I just ran a small experiment and you can wrap rules in an if/else statement:

rule all:
    input:
        "my_output.txt"

upper = config['upper']
text_to_write = "More perFect UnION"

if upper:
    rule write_upper:
        output:
            "my_output.txt"
        run:
            with open(output[0], 'w') as f:
                f.write(text_to_write.upper())
else:
    rule write_lower:
        output:
            "my_output.txt"
        run:
            with open(output[0], 'w') as f:
                f.write(text_to_write.lower())

So we could just wrap the train and train_model_local_or_cpu in a similar if/else statement conditional on a setting in the config.yml

SimonTopp commented 2 years ago

This issue is outdated since dropping train_model_cli in #177 .