【发布时间】:2021-05-24 05:40:41
【问题描述】:
我有一个这样的数据集:
print(X_test.dtypes)
metric1 int64
rank float64
device_type int8
NA_estimate float64
当我尝试对此数据集进行预测时,我收到以下错误:
y_test_pred_xgb = clf_xgb.predict(xgb.DMatrix(X_test))
TypeError: Not supported type for data.<class 'xgboost.core.DMatrix'>
我搜索了一下,但只发现了关于 object 变量数据类型导致问题的讨论。我的数据还有其他问题还是其他问题?我查看了各种博客和 Kaggle 代码,但运气不佳。
【问题讨论】:
-
源代码表明您的类型很好 (github.com/dmlc/xgboost/blob/…) 但也许可以尝试
as.type()将 int8 更改为 int64?还要检查你的数值变量中是否只有数值
标签: python typeerror xgboost xgbclassifier