-
Notifications
You must be signed in to change notification settings - Fork 3
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
Training reorder parameter names for plot #55
base: develop
Are you sure you want to change the base?
Conversation
parts = s.split("_") | ||
alpha_part = s if len(parts) == 1 else s[: -len(parts[-1]) - 1] | ||
numeric_part = int(parts[-1]) if len(parts) > 1 and parts[-1].isdigit() else float("inf") | ||
return (alpha_part, numeric_part, s) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to return s here too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If alpha_part
and numeric part
are the same for two different variables, the entire variable name s
is used for sorting.
@@ -824,6 +828,24 @@ def automatically_determine_group(name: str) -> str: | |||
legend_patches, | |||
) | |||
|
|||
def argsort_name_variablelevel(self) -> list[int]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be worth putting this in to a callback or loss utils? I can see this function being useful for other callbacks in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right. Will do that.
In the newer versions of anemoi-datasets from MARS the variables are not ordered by pressure level anymore but by alphabet, meaning that the order in the loss-plot is also by alphabet (100 is then "smaller" than 20). However, the analysis of the loss weights is more intuitive when ordered by pressure level (or model level).
This PR sorts the variables (for this specific plotting function) in one group by the variable level (if available) interpreting them as digits not strings.