Skip to content

Commit

Permalink
added an optimize test
Browse files Browse the repository at this point in the history
  • Loading branch information
Vytautas Jancauskas committed Feb 24, 2025
1 parent 544262b commit 12b9a27
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/methane_super_emitters/optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
from methane_super_emitters.model import SuperEmitterDetector
from methane_super_emitters.datamodule import TROPOMISuperEmitterDataModule

@click.command()
@click.option("-i", "--input-dir", help="Data directory")
@click.option("-m", "--max-epochs", help="Maximum number of epochs", default=100)
@click.option("-n", "--n-trials", help="Number of trials or points to sample", default=200)
def optimize_model(input_dir, max_epochs, n_trials):
def objective(trial):
fields = ["methane", "u10", "v10", "qa"]
Expand All @@ -24,5 +20,12 @@ def objective(trial):
df.to_csv('opt_results.csv')
print("Best parameters:", study.best_params)

@click.command()
@click.option("-i", "--input-dir", help="Data directory")
@click.option("-m", "--max-epochs", help="Maximum number of epochs", default=100)
@click.option("-n", "--n-trials", help="Number of trials or points to sample", default=200)
def optimize_model_(input_dir, max_epochs, n_trials):
return optimize_model(input_dir, max_epochs, n_trials)

if __name__ == "__main__":
optimize_model()
optimize_model_()

0 comments on commit 12b9a27

Please sign in to comment.