Skip to content
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 15 commits into from
Oct 28, 2024
Merged

Missing value handling #687

merged 15 commits into from
Oct 28, 2024

Conversation

mnwright
Copy link
Member

@mnwright mnwright commented Aug 24, 2023

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 for probability=TRUE
  • Only missings in the predictors x are handled, not in the outcome y
  • Potential slow implementation, have to check computation speed
  • Dirty implementation with repetitive code and no shortcuts if no data is missing at all
  • Not well tested

@mnwright mnwright changed the title Draft missing value handling for classification Missing value handling Jul 2, 2024
@mnwright
Copy link
Member Author

mnwright commented Jul 3, 2024

Now this is also implemented for probability and regression. It's also better tested and faster (no impact if no missing data).

@mnwright mnwright merged commit 776cf96 into master Oct 28, 2024
8 checks passed
@mayer79
Copy link

mayer79 commented Dec 7, 2024

Fantastic, thanks @mnwright

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants