【发布时间】:2021-07-30 10:29:26
【问题描述】:
我正在尝试为 XGB 模型输出构建 ROC 曲线。 我得到的 tpr 和 fpr 数组只有 3 个值,最终只输出一个点的 ROC 曲线:
X = data_db.copy().drop(columns=['Y'])
y = data_db.copy()['Y']
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33, random_state=20)
# XGBoost model
model = XGBClassifier()
model.fit(X_train, y_train)
# make predictions for test data
y_predict = model.predict(X_test)
fpr, tpr, thresholds =roc_curve(y_test,y_predict)
tpr
输出是:
array([0. , 0.98551517, 1. ])
为什么我没有得到超过一个点的 ROC 曲线?
【问题讨论】:
-
你的数据是什么形状,即X_test的长度是多少?
-
7350 行 × 1886 列
标签: python scikit-learn xgboost roc