Xgboost DMatrix 的初始化减少特征数量

Initialization of Xgboost DMatrix reduce features number

我正在尝试了解以下情况:

  1. 当我创建新的 xgbost DMatrix

    xgX = xgb.DMatrix(X, label=Y, missing=np.nan)

  2. 基于输入数据 X 具有 64 个特征

  3. 我得到了具有 55 个特征的新 DMatrix

这里有什么魔法?任何建议都会很棒!

看看 xgboost issue #1223

在那里,khotilov 发表评论:

The problem with CSR is that when you have completely sparse columns at the end, you cannot figure out that they exist by just looking at CSR's indices and pointers.

这样做的结果是,从 XXGDMatrixCreateFromCSR 创建 DMatrix 的函数不考虑末尾的空列,在您的情况下是9 列。您可能想检查您的情况并确定您是否真的在 X.

中拥有 64 个特征