对于数据缺失的问题,XGBoost设计了很好的默认机制处理这个问题。以下摘自陈天奇在GitHub讨论组中的讨论。
- You can directly feed data in as sparse matrix, and only contains non-missing value. i.e. features that are not presented in the sparse feature matrix are treated as ‘missing’.
- XGBoost will handle it internally and you do not need to do anything on it.
- It will depends on how you present the data. If you put data in as LIBSVM format, and list zero features there, it will not be treated as missing.
- Internally, XGBoost will automatically learn what is the best direction to go when a value is missing. Equivalently, this can be viewed as automatically “learn” what is the best imputation value for missing values based on reduction on training loss.
当数据中含有缺失值的时候,我们可以不再填充缺失值。利用XGBoost的机制自动处理缺失值。这时候需要生成libsvm格式的数据。(补充:其实其他格式的数据也可以,我理解错了。)
具体讨论见链接点击。</