Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stdev and mean hot fix #177

Merged
merged 4 commits into from
Nov 15, 2023
Merged

stdev and mean hot fix #177

merged 4 commits into from
Nov 15, 2023

Conversation

bnb32
Copy link
Collaborator

@bnb32 bnb32 commented Nov 11, 2023

Previously computation of multi handler mean and stdev implicitly assumed each handler had roughly the same number of elements. Changed this to include handler weights.

@@ -870,6 +872,9 @@ def get_loss_fun(loss):
"MeanSquaredError" is requested, this will return
an instance of tf.keras.losses.MeanSquaredError()
"""
kwargs = {}
if isinstance(loss, dict):
loss, kwargs = next(iter(loss.items()))
Copy link
Member

Choose a reason for hiding this comment

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

This is a cool way to split a dict key/value! Does it crap out if there are multiple entries?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah this was based on a helpful hint from ruff. Itll only return the first key/value even if there are multiple entries.

data as low res (usually ERA5)"""
data as low res (usually ERA5)

NOTE: When initializing the lr_handler it's important to pick a shape
Copy link
Member

Choose a reason for hiding this comment

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

Nice, i'd like to see us add more of these "gotchas" directly to the docstrings

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

agreed!

@bnb32 bnb32 merged commit 1289644 into main Nov 15, 2023
5 checks passed
@bnb32 bnb32 deleted the bnb/dev branch November 15, 2023 20:59
github-actions bot pushed a commit that referenced this pull request Nov 15, 2023
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.

2 participants