我正在为具有4类的响应变量构建roc曲线。我计算了预测变量,但是当将其输入 pROC 包的函数multiclass.roc
时,会出现以下错误:
Error in roc.default(response, predictor, levels = X, percent = percent, :
Response and predictor must be vectors of the same length.
这是我的代码:
md2 <- glmnet(as.matrix(train), train_label, lambda = cv2$lambda.min, family = 'multinomial', alpha = cv2$alpha)
roc_sexage_elnet <- multiclass.roc(test_label, as.matrix(predict(md2, as.matrix(test), type = "response")))
我尝试检查各种示例,但我对此一无所知。