-
Notifications
You must be signed in to change notification settings - Fork 2
Fix path dependent weighting and accept data frames #31
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
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 updates glex to version 0.5.1 by adding data frame input support, improving the path-dependent weighting algorithm, and expanding tests and documentation.
- Add support for data frame inputs in
glex.xgb.Boosterandglex.ranger, with factor-column checks and matrix conversion - Compute node covers dynamically in C++ (
calculate_data_driven_covers) and pass them torecursePathDependent - Add tests for data frame inputs and update documentation, NEWS, and README
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/testthat/test-glex-dataframe.R | New tests verifying that glex() yields identical results on matrix vs. data frame inputs |
| src/path_dependent_explain_tree.cpp | Implemented calculate_data_driven_covers, updated recursePathDependent to use covers |
| R/glex.R | Added input checks for factor columns and conversion of data frames to matrices |
| README.md | Added reference to new paper on fast PD estimation |
| NEWS.md | Bumped version to 0.5.1 and added release notes |
| DESCRIPTION | Updated package version from 0.5.0 to 0.5.1 |
Comments suppressed due to low confidence (1)
src/path_dependent_explain_tree.cpp:95
- The function is still invoked as a template (
recursePathDependent<...>) but its definition no longer has atemplate<typename Comparison>declaration. Re-add the template header before the function signature or remove the template arguments in calls to ensure it compiles.
NumericMatrix recursePathDependent(
e342afb to
4952eea
Compare
4952eea to
1fb8e9b
Compare
jemus42
left a comment
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.
👍🏻 looks good aside from the README.Rmd thing
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.
Please don't modify README.md directly - it is generated from README.Rmd. Usually there also should be a pre-commit hook to make it impossible to only ever commit one of the two files but I guess that's not installed automatically.
…umns in data frames and update example usage in documentation.
94ff343 to
6003c42
Compare
This pull request introduces a new version (0.5.1) of the
glexpackage, focusing on improving functionality, addressing input handling, and enhancing the algorithm's robustness. Key changes include support for data frame inputs, stricter input validation, and a more robust path-dependent algorithm. Additionally, new tests ensure the correctness of these updates.Version Update and Documentation:
DESCRIPTIONto reflect the new version (0.5.1).NEWS.md, highlighting the fixes to the path-dependent algorithm and support for data frame inputs inglex().Input Handling Improvements:
glex.xgb.Boosterandglex.rangerfunctions inR/glex.Rto accept data frames as input, converting them to matrices when necessary. Added validation to ensure no factor columns are present, with clear error messages. [1] [2]Algorithm Enhancements:
src/path_dependent_explain_tree.cppto compute node covers manually, replacing reliance on precomputed "Cover" values. This ensures correctness and adaptability to different data scenarios. [1] [2]recursePathDependentto use the newly computed node covers for more accurate weight calculations.Testing:
tests/testthat/test-glex-dataframe.Rto verify thatglex()works correctly with both matrix and data frame inputs for XGBoost and Ranger models.Miscellaneous:
README.mdto include references to an additional paper on partial dependence functions.