R中的混淆矩阵

时间:2018-04-18 22:14:42

标签: r

我对混淆矩阵有点麻烦。以前有人有这个问题吗?我检查了观察结果,它们是相同的

library(e1071) # Please install the package first before running library syntax

Svm_Model = svm(t.total_hbat ~ t.inbound_calls_tied + 
              t.hbat_on_tickets_closed_by_agent + 
              t.inb_customer_hold_time, 
            Test_Data,
            kernel="linear",
            cost=.1,
            Scale=F)

Svm_Prediction = predict(Svm_Model,Test_Data,type="class")
View(as.data.frame(Svm_Prediction))

data_final<-cbind(Test_Data,Svm_Prediction)

confusionMatrix(table(Test_Data$t.total_hbat,Svm_Model))

Console:
confusionMatrix(table(Training_Data$t.total_hbat,Svm_Model))
Error in table(Training_Data$t.total_hbat, Svm_Model) : 
  all arguments must have the same length

0 个答案:

没有答案