DMatrix有什么用?

What is the use of DMatrix?

文档说:

Data Matrix used in XGBoost. DMatrix is an internal data structure that is used by XGBoost, which is optimized for both memory efficiency and training speed. You can construct DMatrix from multiple different sources of data.

我明白了,但是 DMatrix 的 difference/use 是什么而不是 Pandas 数据帧?

使用 XGBoost Python package you can choose between two different APIs to train your model. XGB's own Learning API and the Scikit-Learn API.
时 使用 Scikit-Learn 时,API 数据作为 numpy 数组或 pandas 数据帧传递给模型。 使用 Learning API 时,数据使用 DMatrix 传递。

查看 python examples,查看两个 API 都已使用。

基本上您已经在 docs 中找到 “使用 DMatrix 而不是 Pandas Dataframe”:它是 XGBoost 开发人员的数据结构为 “内存效率和训练速度” 创建了他们的机器学习库。