4
$\begingroup$

How do algorithms GBM algorithms, such as XGBoost or LightGBM handle NaN values? I know that they learn how to replace NaN values with other values but my question is: How do they do it exactly?

$\endgroup$
  • 2
    $\begingroup$ In short it creates a third branch as well for missing values and will automatically learn which direction to go when a value is missing, so when the data of a specific value is missing, it takes that direction. Refer arxiv.org/abs/1603.02754 $\endgroup$ – Aditya Jan 6 at 12:49
  • $\begingroup$ What about lightGBM? $\endgroup$ – user10296606 Jan 6 at 13:07
3
$\begingroup$

LIGHTGBM will ignore missing values during a split, then allocate them to whichever side reduces the loss the most. Section 3.2 of this reference explains it.

There are some options you can set such as usemissing=false, which disables handling for missing values. You can also use the zeroas_missing option to change behavior. GitHub

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.