[R-package] added tests on lgb.prepare function #2685
Merged
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.
In this PR, I propose unit tests on the following currently-untested functions in the R package:
lgb.prepare()
lgb.prepare2()
lgb.prepare_rules()
lgb.prepare_rules2()
The tests in this PR cover 100% of the code in those functions and raise the overall test coverage of the package 64.68% to 71.29% (see #2664 for instructions to reproduce that).
This PR also fixes some typos in error messages and removes some unnecessary comments.
While looking at these functions today, I also discovered some areas for improvement. I think it's important to get these tests in place before refactoring the functions. Issues added to #2302
lgb.prepare
functions should convert"logical"
columns to"numeric"
or"integer"
([R-package] lgb.convert() functions should convert columns of type 'logical' #2678)lgb.prepare()
andlgb.prepare_rules()
should convert "integer" columns to "numeric" ([R-package] lgb.prepare() and lgb.prepare_rules() should convert integer columns to numeric #2679)lgb.prepare2()
andlgb.prepare_rules2()
should convert "numeric" columns to "integer" ([R-package] lgb.prepare2() and lgb.prepare_rules2() should convert numeric columns to integer #2680)lgb.prepare
functions should warn on unconverted columns of unsupported types ([R-package] lgb.convert functions should warn on unconverted columns of unsupported types #2681)lgb.prepare_rules()
andlgb.prepare_rules2()
should validate rules ([R-package] lgb.convert_with_rules() should validate rules #2682)lgb.prepare()
andlgb.prepare2()
should be simplified ([R-package] lgb.prepare() and lgb.prepare2() should be simplified #2683)lgb.prepare_rules()
andlgb.prepare_rules2()
should be simplified ([R-package] lgb.prepare() and lgb.prepare2() should be simplified #2684)