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

Implementation of NormalizedReluBounding for non-zero thresholds #64

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from

Conversation

lzampier
Copy link
Member

@lzampier lzampier commented Jan 7, 2025

(pull request already under review in the anemoi-models repository)

This new approach can be used when applying the Relu bounding to a threshold value other than the default 0. An obvious use case is the ocean temperature, which should not go below the freezing temperature of the ocean (approx. 271.15 K). The threshold imputed to the function is normalised according to the normalisation scheme specified in the config file.

Here is an example call to be added to the config:

    - _target_: anemoi.models.layers.bounding.NormalizedReluBounding
      variables:
      - avg_tos
      min_val: [271.15] # Needs to be a list 
      normalizer: ["mean-std"]

In case of multiple variables

    - _target_: anemoi.models.layers.bounding.NormalizedReluBounding
      variables:
      - var1
      - var2
      min_val: [val1, val2] # Needs to be a list 
      normalizer: ["norm1", "norm2"]

@lzampier lzampier self-assigned this Jan 7, 2025
@FussyDuck
Copy link

FussyDuck commented Jan 7, 2025

CLA assistant check
All committers have signed the CLA.

@lzampier lzampier added enhancement New feature or request models labels Jan 8, 2025
Copy link
Collaborator

@jakob-schloer jakob-schloer left a comment

Choose a reason for hiding this comment

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

Great work!

Could you add an example in the config? E.g.

    - _target_: anemoi.models.layers.bounding.NormalizedReluBounding
      variables: [sst]
      min_val: [-2]
      normalizer: ['mean-std']

Could be also commented out.

@lzampier
Copy link
Member Author

Great work!

Could you add an example in the config? E.g.

    - _target_: anemoi.models.layers.bounding.NormalizedReluBounding
      variables: [sst]
      min_val: [-2]
      normalizer: ['mean-std']

Could be also commented out.

Thank you, @jakob-schloer. I have added the commented example in the config.

Copy link
Collaborator

@jakob-schloer jakob-schloer left a comment

Choose a reason for hiding this comment

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

Very nice work! Thanks for including my suggestions.

models/src/anemoi/models/layers/bounding.py Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request models
Projects
Status: Under Review
Development

Successfully merging this pull request may close these issues.

4 participants