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

Feature/mask NaNs in training loss function #72

Draft
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

sahahner
Copy link
Member

@sahahner sahahner commented Oct 2, 2024

Variables with missing values that are imputed by the imputer should not be considered in the loss.

Solves issue 271

Describe the solution
Pass the product of the imputer NaN mask(s) to the loss in the first forward pass and multiply the contributions to the loss of imputed grid points by zero.
Also, apply the remapper to the mask to remap the NaN mask in case the remapper is used.

The NaN masks are prepared in the imputer. The remapper contains a new function to remap the NaN mask.
These changes are part of anemoi-model, PR #56

Attention
This changes the default behaviour when using variables that contain NaN values that are imputed.

@FussyDuck
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ sahahner
❌ jakob-schloer
You have signed the CLA already but the status is still pending? Let us recheck it.

CHANGELOG.md Outdated Show resolved Hide resolved
@HCookie
Copy link
Member

HCookie commented Oct 3, 2024

The loss function code is being altered in #70 to enable flexible configuration of loss functions.
This PR will require some changes to be compatible.

Changes

  • masks will need to be added to ‘mae’, and ‘logcosh’
  • Initialisation of loss functions needs to be pulled from the other PR
  • Setting of the mask will require a ‘hasattr’ check to determine if the loss function exposes that functionality.

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.

4 participants