python xgboost DMatrix - get feature values or convert to np.array I'm trying to create a custom evaluation metric (feval) function for xgboost.cv. It should process some of the training features, however I can't find a way to extract features from xgboost.DMatrix() object (only labels)..

As I was suggested it can be done with first making a DMatrix slice then saving it to a svmlight file and finally reading it with scikit-learn, but is there a more elegant way if doing it?
Currently we cannot direct extract data matrix from DMatrix, mainly due to DMatrix is a internal data structure that may or maynot sit in memory.


--by tqchen commented on 3 Aug 2015

(Source)