make lightgbm raw classification predictions backward and forward compatible #42
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Contributes to #34.
As of microsoft/LightGBM#5133,
lightgbm:::predict.lgb.Booster()
no longer supports keyword argumentsrawscore
,predcontrib
, orpredleaf
.Those were replaced by equivalent values to the
type
argument, for consistency with how most statistical models in R work (from both the standard library and 3rd-party packages).Because of the current state of development in LightGBM, we made the difficult choice to make this change in a non-backwards-compatible way, without a deprecation cycle (microsoft/LightGBM#5133 (review)).
{bonsai}
provides support for generating raw-score predictions from{lightgbm}
models, but that functionality isn't currently covered by tests.Checked with
{covr}
.Rscript \ --vanilla \ -e "covr::report(covr::package_coverage(), file = file.path(getwd(), 'coverage.html'))"
This PR proposes adding a small patch to make
{bonsai}
compatible with previous and future releases of{lightgbm}
, so that the eventual release of{lightgbm}
v4.0.0 will hopefully not be disruptive.It also adds unit tests generating raw predictions for classification models, to cover this functionality and increase the chance of catching future incompatibilities.
How I tested this
Tested against the development version of
{lightgbm}
following using the approach described in #34 (comment).Notes for Reviewers
The unit tests I've added are just enough to cover the relevant code and minimally test that it's producing expected results. If you'd prefer stricter tests, please let me know and I'd be happy to add them.
Thanks very much for your time and consideration.