Skip to content

Hyperparameter tuning#69

Open
SarahAlidoost wants to merge 18 commits into
mainfrom
hyperparameter_tuning
Open

Hyperparameter tuning#69
SarahAlidoost wants to merge 18 commits into
mainfrom
hyperparameter_tuning

Conversation

@SarahAlidoost

@SarahAlidoost SarahAlidoost commented Jul 7, 2026

Copy link
Copy Markdown
Member

closes #40

@SarahAlidoost
SarahAlidoost requested review from meiertgrootes and rogerkuou and removed request for meiertgrootes July 16, 2026 15:18
@SarahAlidoost

Copy link
Copy Markdown
Member Author

@meiertgrootes and @rogerkuou this PR adds support for hyper parameter tuning using ray. I added an example notebook that can be run locally using cpu. In meantime, I'm testing the workflow in levante. See #40 for details on tuning strategy.

@SarahAlidoost
SarahAlidoost marked this pull request as ready for review July 16, 2026 15:20
@rogerkuou

Copy link
Copy Markdown
Collaborator

Hi @SarahAlidoost for now I will only review and test this on my local. Will wait for your signal about the HPC test

@rogerkuou rogerkuou left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @SarahAlidoost , thanks! Just some small comments. After fixing them please feel free to merge!

Comment thread climanet/utils.py
Comment on lines +494 to +497
filename_pattern="*_hr_ERA5dc_masked_tos.nc",
train_range=(2018, 2020),
validation_range=(2021, 2021),
test_range=(2022, 2022),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small opinion here: maybe these default arguments are too strong constraints.

@rogerkuou rogerkuou Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment for the last cell, the experiment_path changes per run. I propose it can be changed to:

check_best_model(Path(best_result.path).parent, test_dataset, run_dir)

so two changes:

  1. I think check_best_model can accept pathlib.Path so no need to convert to str?
  2. Use Path(best_result.path).parent torefer the experiment path

Comment thread climanet/tune.py
return results


def check_best_model(experiment_path: str, test_dataset: STDataset, run_dir):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think both paths here can also accept pathlib.Path?

Suggested change
def check_best_model(experiment_path: str, test_dataset: STDataset, run_dir):
def check_best_model(experiment_path: [str | Path], test_dataset: STDataset, run_dir: [str | Path]):

Comment thread climanet/tune.py
Comment on lines +64 to +66
input_data = xr.open_mfdataset(data_config["input_filenames"])
monthly_data = xr.open_mfdataset(data_config["monthly_filenames"])
lsm_mask = xr.open_dataset(data_config["landmask_filename"])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some small concerns of wrapping this into a function, since this hides API of xr.open_mfdataset

With our current data, for Python<=3.13 this works. While I am using Python=3.14, where the CF concention changed. Then loading input_data and monthly_data will cause kernel error if not specifying chunksizes in open_mfdataset. But this also relates to the Python version where nc files are created.

Maybe we should either expose the args of open_mfdataset, or mention Python<=3.13 in pyproject.toml ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement train/test/validation strategy and hyper-parameter tuning.

2 participants