-
Notifications
You must be signed in to change notification settings - Fork 0
Dev #12
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
Conversation
…or binding pattern features
…ion and prediction
…tead of per context profiles
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.
Pull Request Overview
This PR fixes issues with pre-computed insertion profiles and NA-containing column normalization. The changes ensure that feature order is explicitly maintained during predictions and exclude testing/validation datasets from binding pattern computations.
- Fixed usage of pre-computed insertion profiles by properly handling calcProfile parameter
- Added NA-awareness to normalization functions to prevent all-NA results
- Ensured feature ordering matches model expectations during predictions
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/testthat/test-tfFeatures.R | Added test verifying testing datasets are excluded from binding pattern features |
| tests/testthat/test-predictTfBinding.R | Added test for feature order matching between model and feature matrix |
| tests/testthat/test-insertionProfiles.R | Updated message expectations and added test for mismatched pre-computed profiles |
| tests/testthat/test-getFeatureMatrix.R | Added tests verifying NA preservation in normalization functions |
| tests/testthat/test-contextTfFeatures.R | Added comprehensive tests for pre-computed profile handling |
| R/tfFeatures.R | Added informational messages and excluded testing/validation samples from binding patterns |
| R/predict.R | Replaced column filtering with explicit feature ordering from model |
| R/helpers.R | Added naRm parameter to margin calculation functions |
| R/getInsertionProfiles.R | Added validation for pre-computed profiles and improved messaging |
| R/getFeatureMatrix.R | Added naRm parameter to normalization functions |
| R/contextTfFeatures.R | Added pre-computed profile handling and motif_id assignment |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| modText <- model$save_model_to_string() | ||
| featOrder <- unlist(tstrsplit(modText, split="\n", keep=8)) | ||
| featOrder <- unlist(tstrsplit(gsub("feature_names=","", featOrder), split=" ")) |
Copilot
AI
Oct 27, 2025
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.
The feature order extraction relies on hard-coded line number (keep=8) from the model string representation, which is fragile and may break if the model's string format changes. Consider adding error handling to verify that feature names were successfully extracted, or use a more robust method to access feature names if available in the lightgbm API.
| modText <- model$save_model_to_string() | |
| featOrder <- unlist(tstrsplit(modText, split="\n", keep=8)) | |
| featOrder <- unlist(tstrsplit(gsub("feature_names=","", featOrder), split=" ")) | |
| featOrder <- model$feature_name() |
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.
model$feature_name() does not seem to exist in the R-API of lightgbm
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.
one could still check that the "feature_names=" is present in that row
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.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…f motifs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…retrieving feature names/order
Fixes:
Changes: