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

Set up correct OHE labels for subsets that use default model labels #236

Merged
merged 5 commits into from
Sep 27, 2022

Conversation

ejm714
Copy link
Collaborator

@ejm714 ejm714 commented Sep 27, 2022

Fixes #234

#229 introduced a bug whereby the new columns added to the labels file were in a different order than what is on the model. This PR fixes that by setting up the correct one hot encoded labels in the preprocess_labels validator rather than instantiate_model. Using the use_default_model_labels, we know whether the labels file should contain columns (with all zeroes) for species that are not present in the labels but are on the base model. Using a pd.Categorical before get_dummies allows us to generate these columns.

Running zamba train --config tests/assets/sample_train_config.yaml now works; the labels file has three species present in zamba but trains a model that outputs the full set of 32 labels.

@ejm714 ejm714 requested a review from pjbull September 27, 2022 18:25
@netlify
Copy link

netlify bot commented Sep 27, 2022

Deploy Preview for silly-keller-664934 ready!

Name Link
🔨 Latest commit 0fdbc20
🔍 Latest deploy log https://app.netlify.com/sites/silly-keller-664934/deploys/63334834199b35000819d6d2
😎 Deploy Preview https://deploy-preview-236--silly-keller-664934.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Member

@pjbull pjbull left a comment

Choose a reason for hiding this comment

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

This looks nicer to me!

@github-actions
Copy link
Contributor

github-actions bot commented Sep 27, 2022

@codecov-commenter
Copy link

codecov-commenter commented Sep 27, 2022

Codecov Report

Merging #236 (0fdbc20) into master (0a894a5) will increase coverage by 0.0%.
The diff coverage is 100.0%.

Additional details and impacted files
@@          Coverage Diff           @@
##           master    #236   +/-   ##
======================================
  Coverage    87.2%   87.2%           
======================================
  Files          28      28           
  Lines        1961    1962    +1     
======================================
+ Hits         1710    1711    +1     
  Misses        251     251           
Impacted Files Coverage Δ
zamba/models/model_manager.py 84.3% <ø> (-0.5%) ⬇️
zamba/models/config.py 96.9% <100.0%> (+<0.1%) ⬆️
zamba/models/utils.py 100.0% <100.0%> (ø)

Copy link
Member

@pjbull pjbull left a comment

Choose a reason for hiding this comment

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

LGTM

@pjbull pjbull merged commit 64cb320 into master Sep 27, 2022
@pjbull pjbull deleted the 234-bug-fix branch September 27, 2022 20:09
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.

Validating the species fails if order is different
3 participants