An open API service indexing awesome lists of open source software.

https://github.com/aporia-ai/dmatrix2np

Convert XGBoost's DMatrix format to np.array
https://github.com/aporia-ai/dmatrix2np

machine-learning numpy xgboost

Last synced: 9 months ago
JSON representation

Convert XGBoost's DMatrix format to np.array

Awesome Lists containing this project

README

          

# dmatrix2np

[![Tests](https://github.com/aporia-ai/dmatrix2np/workflows/Test/badge.svg)](https://github.com/aporia-ai/dmatrix2np/actions?workflow=Test) [![PyPI](https://img.shields.io/pypi/v/dmatrix2np.svg)](https://pypi.org/project/dmatrix2np/) [![Downloads](https://pepy.tech/badge/dmatrix2np)](https://pepy.tech/project/dmatrix2np)

Convert XGBoost's DMatrix format to np.array.

Made with :heart: 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](https://python-poetry.org/) 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](https://www.aporia.com/how-to-convert-dmatrix-to-numpy-format-for-your-machine-learning-model-3/)