Skip to content

aporia-ai/dmatrix2np

Repository files navigation

dmatrix2np

Tests PyPI Downloads

Convert XGBoost's DMatrix format to np.array.

Made with ❤️ by Aporia

Usage

To install the library, run:

pip install dmatrix2np

Then, you can call in your code:

from dmatrix2np import dmatrix_to_numpy

converted_np_array = dmatrix_to_numpy(dmatrix)

Development

We use poetry for development:

pip install poetry

To install all dependencies and run tests:

poetry run pytest

To run tests on the entire matrix (Python 3.6, 3.7, 3.8, 3.9 + XGBoost 0.80, 0.90, 1.0, 1.1, 1.2, 1.3, 1.4):

pip install tox
tox

The Research Behind

In the flowing blog post we describe the research that has been done to understand the DMatrix format and creating this library: DMatrix to Numpy Research