Xgboost CV with python custom folds

I am working with data, where each patient can have a different number of training examples. When doing Xgboost CV, I want to make sure that data from the same patient is limited to only one crease, so I need to use creases, which can have a different number of indices.

At the moment of passing a list of numpy arrays containing indices using the 'fold' parameter in the xgb.cv function, I get:

dtrain = dall.slice (np.concatenate ([idset [i] for i in range (nfold) if k! = i])) ValueError: null arrays cannot be concatenated

I followed the same procedure in R without issue, passing my custom pivots as a list, where each item is a vector of test fold indices.

Could you please advise on how to properly pass custom indexes to the Python XGBoost CVG function. Thank!

+3


source to share





All Articles