I encountered this problem while training by gpu-xgb.
xgboost.core.XGBoostError: [03:41:37] …/src/c_api/…/data/array_interface.h:179: Check failed: get(strides.at(0)) == type_length (4 vs. 1) : Memory should be contiguous.
I can’t find the same question on stackoverflow.
I could train at k-fold stage, but I encountered this problem when I trained with full data.
useful training code:
train_index is generated by k_fold.
train_x = df.iloc[train_index] train_users = train_x.index.values train_y = targets.loc[targets.q==t].set_index('session').loc[train_users] clf = XGBClassifier(**xgb_params) clf.fit(train_x[FEATURES].astype('float32'), train_y['correct'], eval_set=[(valid_x[FEATURES].astype('float32'), valid_y['correct'])], verbose=0)
error training code:
clf = XGBClassifier(**xgb_params) clf.fit(df[FEATURES].astype('float32'), train_y['correct'], verbose=0)