3
我創建了我的SVM模型並創建了混淆矩陣,它看起來不像我習慣的正常混淆矩陣,例如:False Positive,True Positive,True Negative,False Negative format。如何獲取SVM的分類錯誤?
我需要得到分類錯誤。我看了幾個資源,但仍然處於虧損狀態。
trainIndex <- createDataPartition(datasetclass$V1,list=FALSE, p = .80,times=1)
dataTrain <- datasetattributes[ trainIndex,]
dataTest <- datasetattributes[-trainIndex,]
classTrain <- datasetclass[ trainIndex,]
classTest <- datasetclass[-trainIndex,]
svm.model <- svm(classTrain ~ ., data = dataTrain, cost = 1)
svm.pred <- predict(svm.model, dataTest)
# confusion matrix
tab <- table(pred = svm.pred, true = classTest)