【问题标题】:I'm getting an error while trying to create a confusion matrix我在尝试创建混淆矩阵时遇到错误
【发布时间】:2020-08-01 02:25:17
【问题描述】:

我在尝试生成混淆矩阵时遇到以下错误 - 这曾经有效。

str(credit_test)
# Generate predicted classes using the model object
class_prediction <- predict(object=credit_model,  
                            newdata=credit_test,  
                            type="class")       
class(class_prediction)
class(credit_test$ACCURACY)
# Calculate the confusion matrix for the test set
confusionMatrix(data=class_prediction, reference=credit_test$ACCURACY) 
'data.frame':   20 obs. of  4 variables:
$ ACCURACY  : Factor w/ 2 levels "win","lose": 1 1 1 2 2 1 1 1 1 1 ...
$ PM_HIGH   : num  5.7 5.12 10.96 7.99 1.73 ...
$ OPEN_PRICE: num  4.46 3.82 9.35 7.77 1.54 5.17 1.88 2.65 5.71 4.09 ...
$ PM_VOLUME : num  0.458 0.676 1.591 3.974 1.785 ...
[1] "factor"
[1] "factor"
**Error in confusionMatrix(data=class_prediction, reference=credit_test$ACCURACY) : 
unused arguments (data=class_prediction, reference=credit_test$ACCURACY)**

【问题讨论】:

  • 得到以下错误而不是Error in confusionMatrix_(actual, predicted, cutoff) : argument "predicted" is missing, with no default

标签: r classification r-caret confusion-matrix


【解决方案1】:

出于某种原因,我不得不以这种方式运行它,有些事情发生了变化 caret::confusionMatrix(data=class_prediction,reference=credit_test$ACCURACY)

【讨论】:

    猜你喜欢
    • 2022-12-08
    • 2021-10-04
    • 2021-03-02
    • 1970-01-01
    • 2019-10-15
    • 2015-09-18
    • 1970-01-01
    • 2018-04-27
    • 1970-01-01
    相关资源
    最近更新 更多