使用svm预测值

时间:2016-01-14 15:35:17

标签: r machine-learning svm

我有以下数据集(df):

 won  EXPG1   EXPG2
41   1 1.4200 0.93285
42   0 1.3105 1.11580
43   2 1.3678 0.90433
44   2 1.1773 0.96671
45   2 1.3541 0.89154
46   2 1.1768 0.99026

我想根据svm模型来确定赢得的价值。所以我这样做:

#create traing/test set
inTrain <- createDataPartition(y=df$won, p=0.7, list=FALSE)
training <- df[inTrain, ]
testing <- df[-inTrain, ]


#create model
model <- svm(won ~ EXPG1 + EXPG2 , training)
Prediction <- predict(model, testing)
conf <- confusionMatrix(Prediction, testing$won)

当我点击conf时,这会给我以下值:

Pos Pred Value         0.5150      NaN   0.4817

我不明白为什么我没有得到1的正面预测值。有人可以向我解释出了什么问题吗?

这是我完整的混淆矩阵:

Confusion Matrix and Statistics

      Reference
Prediction   0   1   2
     0 130  55  51
     1   0   0   0
     2 281 350 603

Overall Statistics

           Accuracy : 0.4986          
             95% CI : (0.4728, 0.5245)
No Information Rate : 0.4449          
P-Value [Acc > NIR] : 1.992e-05       

              Kappa : 0.138           
Mcnemar's Test P-Value : < 2.2e-16       

Statistics by Class:

                 Class: 0 Class: 1 Class: 2
Sensitivity           0.31630   0.0000   0.9220
Specificity           0.89991   1.0000   0.2267
Pos Pred Value        0.55085      NaN   0.4887
Neg Pred Value        0.77229   0.7245   0.7839
Prevalence            0.27959   0.2755   0.4449
Detection Rate        0.08844   0.0000   0.4102
Detection Prevalence  0.16054   0.0000   0.8395
Balanced Accuracy     0.60810   0.5000   0.5744

0 个答案:

没有答案