簡體   English   中英

我在嘗試創建混淆矩陣時遇到錯誤

[英]I'm getting an error while trying to create a confusion matrix

嘗試生成混淆矩陣時出現以下錯誤 - 這曾經有效。

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)**

由於某種原因,我不得不以這種方式運行它,發生了一些變化caret::confusionMatrix(data=class_prediction,reference=credit_test$ACCURACY)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM