I'd like to inspect the DMatrix
object. The documentation mentions the methods to get the number of rows and columns and also the slice at each row:
dmatrix.slice(index)
But I'd like to do more complex transformations using numpy. Is there a simple way to convert the DMatrix
to a numpy array?
DMatrix is a one-way street! Once you get DMatrix, you cannot get back its content as numpy.ndarray
or pandas.DataFrame
.
[Update] A library is implemented only for the particular task of convert XGBoost's DMatrix format to numpy.array
: https://github.com/aporia-ai/dmatrix2np
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With