【发布时间】:2021-06-12 19:12:54
【问题描述】:
我在多类问题中使用随机森林分类器。
rf = RandomForestClassifier(()
rf.fit(train_X, train_y)
然后进行预测:
pred = rf.predict(test_X)
那么我想像这样计算roc_auc_score:
roc_value = roc_auc_score(test_y, pred, average='weighted',
multi_class='ovr',labels=[0,1,2,3,4])
但这会报错:
numpy.AxisError: axis 1 is out of bounds for array of dimension 1
我该如何解决这个问题?
【问题讨论】:
标签: scikit-learn random-forest roc auc