Xgb.cv is throwing error while xgb.train is working fine

Hi All,

I have tried to use xgb.cv but it is throwing error while xgb.train is working fine.
import xgboost as xgb

Create regression matrices

dtrain_clf = xgb.DMatrix(X_train, y_train, enable_categorical=True)
dtest_clf = xgb.DMatrix(X_test, y_test, enable_categorical=True)

params = {“objective”: “binary:logistic”, “tree_method”: “hist”,‘num_class’: 3 }
n = 1000

results = xgb.cv(params,
dtrain_clf,
num_boost_round=n,
nfold=10,
metrics=[“mlogloss”, “auc”, “merror”]
)

I am getting this error

XGBoostError: [16:06:17] C:\buildkite-agent\builds\buildkite-windows-cpu-autoscaling-group-i-07593ffd91cd9da33-1\xgboost\xgboost-ci-windows\src\objective\regression_obj.cu:52: Check failed: info.labels.Size() == preds.Size() (387 vs. 1161) : Invalid shape of labels.

Can anyone help me in this.

Thanks!
Anmol