-
-
Notifications
You must be signed in to change notification settings - Fork 194
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
Missing value handling #687
Merged
Merged
Conversation
This file contains 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
mnwright
changed the title
Draft missing value handling for classification
Missing value handling
Jul 2, 2024
Now this is also implemented for probability and regression. It's also better tested and faster (no impact if no missing data). |
Fantastic, thanks @mnwright |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 is a quick and dirty implementation of missing value handling as done by other packages such as xgboost, lightgbm and scikit-learn. When splitting a node, missing values are ignored for calculating an initial split criterium value (i.e., decrease of impurity). Then for the best split, the missings are tried in the left child node and in the right child node and the choice is made based again on the split criterium value. For prediction, this direction is saved as the "default" direction. If a missing occurs in prediction at a node where there is no default direction, it goes left.
Caveats:
So far only implemented for classification with the default (Gini) splitting, also not forprobability=TRUE
Potential slow implementation, have to check computation speedDirty implementation with repetitive code and no shortcuts if no data is missing at allNot well tested