表中的错误(数据,引用,dnn = dnn,...):在 R 中运行带有插入符号的混淆矩阵时,所有参数必须具有相同的长度

2024-01-09

我在运行混淆矩阵时遇到问题。

这就是我所做的:

rf <- caret::train(tested ~., 
                               data = training_data, 
                               method = "rf",
                               trControl = ctrlInside,
                               metric = "ROC", 
                               na.action = na.exclude)

rf

获得模型后,这是我采取的下一步:

evalResult.rf <- predict(rf, testing_data, type = "prob")
predict_rf <- as.factor(ifelse(evalResult.rf <0.5, "positive", "negative"))

然后我运行我的混淆矩阵。

cm_rf_forest <- confusionMatrix(predict_rf, testing_data$tested, "positive") 

在我应用混淆矩阵后出现错误:

Error in table(data, reference, dnn = dnn, ...) : 
  all arguments must have the same length

尽管如此,我还是给你一些我的数据。

列车数据:

structure(list(tested = structure(c(1L, 1L, 1L, 1L, 1L, 
1L), .Label = c("negative", "positive"), class = "factor"), Gender = structure(c(2L, 
2L, 1L, 1L, 2L, 2L), .Label = c("Female", "Male", "Other"), class = "factor"), 
    Age = c(63, 23, 28, 40, 31, 60), number_days_symptoms = c(1, 
    1, 16, 1, 14, 1), care_home_worker = structure(c(1L, 2L, 
    1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"), 
    health_care_worker = structure(c(1L, 1L, 1L, 1L, 2L, 1L), .Label = c("No", 
    "Yes"), class = "factor"), how_unwell = c(1, 1, 6, 4, 2, 
    1), self_diagnosis = structure(c(1L, 1L, 2L, 1L, 2L, 1L), .Label = c("No", 
    "Yes"), class = "factor"), chills = structure(c(1L, 1L, 2L, 
    1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"), 
    cough = structure(c(1L, 1L, 2L, 2L, 1L, 1L), .Label = c("No", 
    "Yes"), class = "factor"), diarrhoea = structure(c(1L, 1L, 
    1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"), 
    fatigue = structure(c(1L, 2L, 2L, 2L, 2L, 1L), .Label = c("No", 
    "Yes"), class = "factor"), headache = structure(c(2L, 2L, 
    3L, 2L, 2L, 2L), .Label = c("Headcahe", "No", "Yes"), class = "factor"), 
    loss_smell_taste = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No", 
    "Yes"), class = "factor"), muscle_ache = structure(c(1L, 
    1L, 2L, 2L, 2L, 2L), .Label = c("No", "Yes"), class = "factor"), 
    nasal_congestion = structure(c(1L, 1L, 1L, 2L, 1L, 1L), .Label = c("No", 
    "Yes"), class = "factor"), nausea_vomiting = structure(c(1L, 
    1L, 1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"), 
    shortness_breath = structure(c(1L, 1L, 1L, 1L, 2L, 1L), .Label = c("No", 
    "Yes"), class = "factor"), sore_throat = structure(c(1L, 
    1L, 1L, 2L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"), 
    sputum = structure(c(1L, 1L, 2L, 2L, 1L, 1L), .Label = c("No", 
    "Yes"), class = "factor"), temperature = structure(c(4L, 
    4L, 4L, 4L, 1L, 4L), .Label = c("37.5-38", "38.1-39", "39.1-41", 
    "No"), class = "factor"), asthma = structure(c(2L, 1L, 1L, 
    1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"), 
    diabetes_type_one = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No", 
    "Yes"), class = "factor"), diabetes_type_two = structure(c(2L, 
    1L, 1L, 1L, 1L, 2L), .Label = c("No", "Yes"), class = "factor"), 
    obesity = structure(c(1L, 2L, 2L, 1L, 1L, 1L), .Label = c("No", 
    "Yes"), class = "factor"), hypertension = structure(c(1L, 
    1L, 2L, 1L, 1L, 2L), .Label = c("No", "Yes"), class = "factor"), 
    heart_disease = structure(c(1L, 1L, 1L, 1L, 1L, 2L), .Label = c("No", 
    "Yes"), class = "factor"), lung_condition = structure(c(1L, 
    1L, 1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"), 
    liver_disease = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No", 
    "Yes"), class = "factor"), kidney_disease = structure(c(1L, 
    1L, 1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor")), row.names = c(1L, 
3L, 4L, 5L, 6L, 7L), class = "data.frame")

这是我的测试数据:

structure(list(tested = structure(c(1L, 1L, 1L, 1L, 1L, 
1L), .Label = c("negative", "positive"), class = "factor"), Gender = structure(c(1L, 
2L, 1L, 1L, 1L, 2L), .Label = c("Female", "Male", "Other"), class = "factor"), 
    Age = c(19, 26, 30, 45, 40, 43), number_days_symptoms = c(20, 
    1, 1, 20, 14, 1), care_home_worker = structure(c(1L, 1L, 
    1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"), 
    health_care_worker = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No", 
    "Yes"), class = "factor"), how_unwell = c(7, 6, 6, 6, 6, 
    2), self_diagnosis = structure(c(2L, 1L, 1L, 2L, 2L, 1L), .Label = c("No", 
    "Yes"), class = "factor"), chills = structure(c(2L, 1L, 1L, 
    1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"), 
    cough = structure(c(2L, 1L, 1L, 2L, 2L, 1L), .Label = c("No", 
    "Yes"), class = "factor"), diarrhoea = structure(c(2L, 1L, 
    1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"), 
    fatigue = structure(c(2L, 1L, 1L, 2L, 2L, 1L), .Label = c("No", 
    "Yes"), class = "factor"), headache = structure(c(2L, 2L, 
    2L, 3L, 2L, 3L), .Label = c("Headcahe", "No", "Yes"), class = "factor"), 
    loss_smell_taste = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No", 
    "Yes"), class = "factor"), muscle_ache = structure(c(2L, 
    1L, 1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"), 
    nasal_congestion = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No", 
    "Yes"), class = "factor"), nausea_vomiting = structure(c(1L, 
    1L, 1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"), 
    shortness_breath = structure(c(2L, 1L, 1L, 1L, 1L, 1L), .Label = c("No", 
    "Yes"), class = "factor"), sore_throat = structure(c(1L, 
    1L, 1L, 2L, 1L, 2L), .Label = c("No", "Yes"), class = "factor"), 
    sputum = structure(c(2L, 1L, 1L, 2L, 1L, 2L), .Label = c("No", 
    "Yes"), class = "factor"), temperature = structure(c(4L, 
    4L, 4L, 1L, 1L, 4L), .Label = c("37.5-38", "38.1-39", "39.1-41", 
    "No"), class = "factor"), asthma = structure(c(1L, 1L, 1L, 
    1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"), 
    diabetes_type_one = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No", 
    "Yes"), class = "factor"), diabetes_type_two = structure(c(1L, 
    1L, 1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"), 
    obesity = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No", 
    "Yes"), class = "factor"), hypertension = structure(c(1L, 
    1L, 1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"), 
    heart_disease = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No", 
    "Yes"), class = "factor"), lung_condition = structure(c(1L, 
    1L, 1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"), 
    liver_disease = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No", 
    "Yes"), class = "factor"), kidney_disease = structure(c(1L, 
    1L, 1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor")), row.names = c(2L, 
8L, 11L, 14L, 20L, 27L), class = "data.frame")

此外,我还在 ctrInside 中的子样本上执行了 smote 平衡类。

这是我的 smote 功能:

smotest <- list(name = "SMOTE with more neighbors!",
                func = function (x, y) {
                  115
                  library(DMwR)
                  dat <- if (is.data.frame(x)) x else as.data.frame(x)
                  dat$.y <- y
                  dat <- SMOTE(.y ~ ., data = dat, k = 3, perc.over = 100, perc.under =
                                 200)
                  list(x = dat[, !grepl(".y", colnames(dat), fixed = TRUE)],
                       y = dat$.y) },
                first = TRUE)

ctrlInside 是这样的:

ctrlInside <- trainControl(method = "repeatedcv", 
                           number = 10,
                           repeats = 5,
                           summaryFunction = twoClassSummary,
                           classProbs = TRUE,
                           savePredictions = TRUE, 
                           search = "grid",
                           sampling = smotest)

给出这些功能只是为了让您了解我在做什么。发生这种情况有原因吗?


你可以使用complete.cases来预测那些没有nas的情况,而且你必须对矩阵进行操作,我将在下面展示。使用示例数据集,我在 NA 列中生成 10 个变量,并进行训练:

idx = sample(nrow(iris),100)
data = iris
data$Petal.Length[sample(nrow(data),10)] = NA
data$tested = factor(ifelse(data$Species=="versicolor","positive","negative"))
data = data[,-5]
training_data = data[idx,]
testing_data= data[-idx,]

rf <- caret::train(tested ~., data = training_data, 
                              method = "rf",
                              trControl = ctrlInside,
                              metric = "ROC", 
                              na.action = na.exclude)

做一下评估结果,你可以看到我得到了同样的错误:

evalResult.rf <- predict(rf, testing_data, type = "prob")
predict_rf <- as.factor(ifelse(evalResult.rf <0.5, "positive", "negative"))
cm_rf_forest <- confusionMatrix(predict_rf, testing_data$tested, "positive") 

Error in table(data, reference, dnn = dnn, ...) : 
  all arguments must have the same length

所以有两个错误来源,1..你有 NA,他们无法预测这一点,其次,evalResult.rf 返回一个概率矩阵,第一列是负类概率,第二列是正类概率:

head(evalResult.rf)
   negative positive
3     1.000    0.000
6     1.000    0.000
9     0.948    0.052
12    1.000    0.000
13    0.976    0.024
19    0.998    0.002

要获取类,您需要获取每行具有最大值的列,并返回相应的列名称,即类:

colnames(evalResult.rf)[max.col(evalResult.rf)]

我们现在做:

testing_data = testing_data[complete.cases(testing_data),]
evalResult.rf <- predict(rf, testing_data, type = "prob")
predict_rf <- factor(colnames(evalResult.rf)[max.col(evalResult.rf)])
cm_rf_forest <- confusionMatrix(predict_rf, testing_data$tested, "positive")

Confusion Matrix and Statistics

          Reference
Prediction negative positive
  negative       33        1
  positive        0       11

               Accuracy : 0.9778          
                 95% CI : (0.8823, 0.9994)
    No Information Rate : 0.7333          
    P-Value [Acc > NIR] : 1.507e-05       

                  Kappa : 0.9416     
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

表中的错误(数据,引用,dnn = dnn,...):在 R 中运行带有插入符号的混淆矩阵时,所有参数必须具有相同的长度 的相关文章

  • 根据一个或多个下拉选项创建具有不同类型线型的折线图

    在下面闪亮的应用程序中 我尝试根据侧边栏中的下拉选择创建点线图 我已成功在选择一个指标时创建折线图 但无法选择 2 个指标 为了x and y我想要一个solid线 对于x1 and y1我想要一个dashed线和对于x2 and y2一条
  • 事后如何使用保存的.rds h2o模型进行预测?

    我使用 mlr 和 h2o 包创建了一个 R 模型 如下所示 library h2o rfh20 lrn makeLearner classif h2o randomForest predict type prob 完成模型调整 模型启动
  • 如何使用“NA”作为字符串

    我有一个 csv 文件 其中一列是字符类型 该变量的很少有值是 NA 字符串 但是当我使用 read csv 读取 R 中的 csv 文件时 NA 字符串存储为 NA 我该如何修复它 您可以使用na strings论证中read csv r
  • 单击 hPlot 图表中闪亮的数据点时打印组名称

    我有一个闪亮的应用程序 它使用 rCharts 中的 highcharts 库显示一些图表 在某些情况下 我在单个图表上有多个图表 这些图表是使用 hPlot 中的组选项创建的 我希望在单击图表时打印单个数据点的所有参数 x y 和组值 我
  • 在 R data.table 中计算时间增量

    我有一个篮球运动员数据的数据表 其中包括每场比赛和多名球员的比赛日期 我想创建一个列来计算自上一场比赛以来的天数 我在 R 中使用 data table 包 PLAYERID GAME DATE 1 2989 2014 01 1 2 298
  • 基于两列对数据框中的行进行求和[重复]

    这个问题在这里已经有答案了 我想添加一列的值 将它们按两列分组 我找到了如何在一列上执行此操作 但无法弄清楚如何在两列上执行此操作 例如 如果我有以下数据框 x c a a b b c c a a b b c c a a b b c c y
  • 尝试使用 movie3d 制作 3D PCA 图(rgl)的电影

    我已经使用 pca3d 包在 R 中制作了 rgl 3D PCA 图 并且我正在尝试使用 movie3d 制作一个包含旋转图电影的 gif 文件 pca3d 包 makeMoviePCA 中有一个函数 它将其参数传递给 movie3d 这是
  • keras 模型拟合:ValueError:无法找到可以处理输入的数据适配器:

    我正在构建一个简单的 CNN 模型用于多类分类 训练和测试数据位于data path根据所需的类子目录flow from directory的函数ImageDataGenerator 这是我根据数据构建和训练模型的代码 from tenso
  • MultiHeadAttention Attention_mask [Keras、Tensorflow] 示例

    我正在努力掩盖 MultiHeadAttention 层的输入 我正在使用 Keras 文档中的 Transformer Block 进行自我关注 到目前为止 我在网上找不到任何示例代码 如果有人能给我一个代码片段 我将不胜感激 变压器块来
  • 使用多边形图层下方的轮廓线切割多边形

    我想根据高程将多边形图层切割成两部分 上部和下部 多边形可能是凸的或凹的 并且切割的位置可能彼此不同 等高线的间隔为 5m 这意味着我可能需要生成一个具有更紧凑的等高线的等高线 例如 1m 的间隔 关于如何做到这一点的任何想法 在 ArcG
  • 如何加速 svm.predict?

    我正在编写一个滑动窗口来提取特征并将其输入到 CvSVM 的预测函数中 然而 我偶然发现 svm predict 函数相对较慢 基本上 窗口以固定的步幅长度在图像比例上滑动穿过图像 遍历图像加上提取每个图像特征的速度 窗口大约需要 1000
  • 闪亮的传单添加大量分离的折线

    我有一个 200k 行数据集 其中包含出发地和目的地的坐标 我有一个 R 闪亮的应用程序 带有传单地图 可以在这些坐标上显示圆圈 尽管坐标数量很大 但效果很好 这是数据的简化示例 每行包含出行id 出发地经纬度 目的地经纬度 id lat
  • 数据框中按行相关

    我正在尝试计算大型数据帧的所有行之间的相关性 到目前为止已经提出了一个有效的简单 for 循环 例如 name lt c a b c d col1 lt c 43 78 43 84 37 92 31 72 col2 lt c 43 80 4
  • R 监督潜在狄利克雷分配包

    我在用着这个LDA包 https cran r project org web packages lda 对于 R 具体来说 我正在尝试做监督潜在狄利克雷分配 slda https www cs princeton edu blei pap
  • GitHub 操作 setup-r-dependency 失败,说明没有名为“digest”的包

    我一直在尝试设置一些 GitHub 操作来自动检查我的 R 包并运行测试覆盖率 我目前正在使用 setup r dependency v2 操作来安装依赖项 但无法安装包 digest 返回以下错误 Error Error
  • 正则表达式在 R 中同时多次包含字母/特殊字符时删除单词

    我想删除那些单词中字母 特殊字符的数量同时出现两次以上的单词 例如 输入就像 Google in theee lland of whhhat c c and e 输出应该是 Google in lland of c c and x lt G
  • 与heroku配合使用的统计引擎

    我有一个 Heroku Rails 应用程序 需要处理一些重要的数字 并且我需要使用像 R 这样的统计库 更糟糕的是 MatLab 我正在寻找以下任何问题的答案 是否有不需要二进制文件的功能齐全的统计包 GEM 是否可以将 R 二进制文件作
  • 了解日期并使用 R 中的 ggplot2 绘制直方图

    主要问题 当尝试使用 ggplot2 制作直方图时 我无法理解为什么日期 标签和中断的处理无法像我在 R 中预期的那样工作 我在找 我的约会频率的直方图 刻度线位于匹配条下方的中心 日期标签在 Y b format 适当的限制 最小化网格空
  • 如何在复杂的皂膜GAM中设置更平滑的边界条件?

    我正在对南太平洋岛屿泻湖中宽吻海豚的分布进行建模 我想使用肥皂膜平滑器来模拟海豚在二维表面 经度 x 纬度 上存在的概率 考虑到陆地边界 显然海豚不能在陆地上行走 我想知道如何将我的研究区域 陆地和近海水域 的边界固定为等于零的条件 因为我
  • 二部图匹配以匹配两个集合

    我是新手igraphR 中的包 我有两套A and B 每个都有N顶点 A1 A2 AN and B1 B2 BN 每个元素之间都有一个边缘A对每一个元素B 我有一个函数fWgt Ai Bj 返回之间的边的权重Ai and Bj 我一直在尝

随机推荐

  • JavaScript 和非常长的字符串

    我在使用以下代码时遇到问题 function showTableData var tableArray var x 0 var theHTML for i 0 i lt 7032 i if x 0 theHTML tr th class s
  • 链接到不带 .lib 的 .dll 文件

    我需要将一些Delphi代码重写为C 并且我们需要链接到动态库TMLComm2004 dll 事实证明我们没有 lib文件 因此我们决定使用以下命令行生成它 dumpbin EXPORTS C Users fayard Desktop TM
  • 如何从 Java 验证 HTML?

    从 Java 验证 HTML 的快速而简单的方法是什么 我正在寻找一个开源 PD 类 或一组类 来描述 100 多个 HTML 标签的各种属性 例如 标签是可选的吗 空的 省略其结束标签是否合法 该标签还可以包含哪些其他标签 如果有 哪些属
  • 所有 JPEG 文件都是 JFIF 吗?

    Active Directory 可以按照 JPEG 文件交换格式 JFIF 存储图像jpegPhoto 属性定义 http msdn microsoft com en us library ms676813 VS 85 aspx 我想使用
  • 如何从 Catch 块返回错误消息。现在返回空

    下面给出了我的 ApiKey 验证示例代码 我使用的是 MVC4 Web api RC public class ApiKeyFilter ActionFilterAttribute public override void OnActio
  • 如何验证关联的模型ID?

    我有一个学生和一个课程模型 学生属于课程 课程有很多学生 class Student lt ActiveRecord Base attr accessible course id name password status studentID
  • Rails:使用现有数据更改现有列的数据类型的影响

    我可能在错误的地方问这个问题 所以如果我是这样的话 请放轻松并为我指出正确的方向 我无法理解使用 Rails 中的现有数据更改现有表中现有列的数据类型将如何影响我正在开发的任何应用程序 如果我有一个名为的布尔列football The fo
  • 通过用户 ID 查询 Google Analytics

    有没有办法使用查询结果核心报告 API v3 https developers google com analytics devguides reporting core v3 并通过以下方式过滤这些结果User ID https deve
  • 在哪里可以找到 Microsoft 应用程序的应用程序 ID URI?

    我正在尝试以我注册的应用程序身份登录 并授予以下权限 Azure 门户 gt 应用程序注册 gt 应用程序注册 预览 gt 我的应用程序名称 API 权限 根据本文档 https learn microsoft com en us grap
  • 如何在 Swift 3.0 中将字符串转换为 UIColor?

    我正在尝试将使用预定义颜色列表的现有程序从 Objective C 转换为 Swift 原始代码使用Selector来提取一个UIColor基于它的名称表示为NSString define UIColorFromRGB rgbValue U
  • 正则表达式使 3 个单词彼此靠近。如何获取他们的上下文?

    我有以下字符串 text I love jam I like all other kinds of confectionery as well cakes and croissants and things Bagels too Carbs
  • 如何执行另一个php脚本?

    如何执行另一个 php 脚本 我想从我的 php 文件执行 3 个 php 脚本 而不需要等待 3 个脚本完成 换句话说 这 3 个 php 文件需要同时执行 并行 而不是一个接一个 顺序 执行 这 3 个脚本位于我的主 php 文件 脚本
  • 使用 PANDAS 在数据帧列中查找多个精确的字符串匹配

    我有数百万个条目数据集 其中包含人类输入的观察结果 以指示某些 操作 结果 尝试创建一些类别 我需要查看此列并提取某些确切的内容 最常用的表达方式 它们可以出现在字符串的开头 结尾或中间 并且可以缩写也可以不缩写 我构建了以下示例 data
  • Netbeans 不会自动缩进 (Java)

    我有一个大学项目 我必须编写一个 Java 应用程序 由于我们使用 Netbeans 作为 IDE 来学习 Java 因此我决定使用此 IDE 来编写应用程序代码 我以前的电脑上从未遇到过这个错误 现在 当我在编写函数或任何其他块后打开 时
  • 加载脚本时何时使用异步与延迟?

    所以我最近了解到 将 js 放在 DOM 底部已经过时了 我应该再次将它们放在具有 async 和 defer 属性 伟大的 但我对根据优先级应该使用哪个感到有点困惑 所以我有 jquery jquery 插件不会立即影响外观 页 对页面外
  • C# wpf 滚动查看器不像 Windows 商店应用程序那样工作

    我目前正在开发一个使用 WPF 的应用程序 我不得不注意到 ScrollViewer 功能与 Windows 应用商店应用程序变体相比的差异 当我位于屏幕边缘和 ScrollViewer 边缘时 我想要滑动以便远离边缘 我看到 Window
  • MySQL IN 子句中的多列

    我有一个数据库 其中有四列 分别对应于起始位置和结束位置的地理坐标 x y 这些列是 x0 y0 x1 y1 我有这四列的索引 序列为 x0 y0 x1 y1 我有一份大约一百个地理对组合的清单 我将如何有效地查询这些数据 我想做这样的事情
  • 没有虚拟构造函数,但有虚拟析构函数

    如果我们没有虚拟构造函数那么为什么我们有虚拟析构函数 构造函数也可以是虚拟的吗 虚拟构造函数没有意义 你确切地声明了什么 类型被创建 并且在编译时是众所周知的 编译器 不需要 并且实际上不能 因为动态调度是基于 仅在创建对象后才创建的信息
  • 如何配置 Maven 2 的 Surefire 插件来运行 Junit 4.5?

    Maven 2 似乎没有考虑我的 Test 和 Ignore 注释 如何配置 Surefire 插件来运行和使用注释 这个问题还没有答案 我首先将您的主 POM 配置为默认将 Surefire 插件设置为最新版本 这是通过向 POM 的插件
  • 表中的错误(数据,引用,dnn = dnn,...):在 R 中运行带有插入符号的混淆矩阵时,所有参数必须具有相同的长度

    我在运行混淆矩阵时遇到问题 这就是我所做的 rf lt caret train tested data training data method rf trControl ctrlInside metric ROC na action na