[R-package] Improvements, readability, and bug fixes#378
Merged
guolinke merged 2 commits intomicrosoft:masterfrom Apr 3, 2017
Laurae2:patch-13
Merged
[R-package] Improvements, readability, and bug fixes#378guolinke merged 2 commits intomicrosoft:masterfrom Laurae2:patch-13
guolinke merged 2 commits intomicrosoft:masterfrom
Laurae2:patch-13
Conversation
|
@Laurae2, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This PR is large-sized changes for the R package. There are issues to solve which will not be fixed in this PR, as they are already on the master branch.
R improvements and bug fixes:
regression_l1,regression_l2,huber,fair,poisson, which were unusable previously due to hard-coded rules.regression_l1(MAE),regression_l2(MSE),huber(MAE),fair(MAE),poisson(Poisson loss):getinfo,setinfo,sliceglobal environment name clash).lgb.unloaderwhich wipes LightGBM environment so we can avoid restarting R when an object gets stuck in memory for no apparent reason (like when training over training different things on same variables which have changed).lgb.unloadercan fully wipe LightGBM objects in the specified environment (lgb.Booster,lgb.Dataset), and will not cause an error whenlightgbmwas already detached from the R environment.lgb.unloader."free booster handle"message on Predictor typesdim.lgb.Dataset,dimnames.lgb.Datasetfunctions' exampledontruntagR readability/stylistic changes:
R issues to solve in future PRs, not now:
devtools::checkon any function currently (might reverse this later, in the future - we would need Travis setup).devtools::check()to inspect the whole code which is essential for checking for code correctness (without having to run everything by hand). Potentially a regression from PR Support build self-contained R package. #340 to answer issue Relative paths in R-package prevent source package build #339 (not sure though, it is a strange lock bug). This will not pass in CRAN in its current state as the lock does not allow to run CRAN tests (need to unload library properly) - we still have no CRAN release, therefore this is not a major issue currently.library(lightgbm)in examples (not allowed without\{dontrun})<<-) on the global environment (not easy to fix at all).data.table::rbindlist).Tests performed:
Example for testing a new loss (ex: Poisson loss):
Beginning of training log (does not converge because it is not the right objective obviously, and there are too many 0s, which makes it nearly impossible - this is normal because it is not a dataset for Poisson regression):