Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201867

Why there is so much difference in accuracy from fit model evaluation and confusion matrix by class. using R

$
0
0

This is how i try to interpret result from model which is only printing Model_RF_RF using random forest and below is using confusion matrix but why accuracy is so different. Model_RF_RF<-randomForest(Label ~ .,data = train.tokens.tfidf.df,ntree=500,mtry=82,importance=TRUE, + proximity=TRUE,trControl = cv.cntrl,nodesize=10)

Model_RF_RF

Call:
 randomForest(formula = Label ~ ., data = train.tokens.tfidf.df,      ntree = 500, mtry = 82, importance = TRUE, proximity = TRUE,      trControl = cv.cntrl, nodesize = 10) 
               Type of random forest: classification
                     Number of trees: 500
No. of variables tried at each split: 82

        OOB estimate of  error rate: 44.56%
Confusion matrix:
       HIGH LOW MEDIUM class.error
HIGH     46   3     72   0.6198347
LOW       3  25     93   0.7933884
MEDIUM   22  20    194   0.1779661
> confusionMatrix(PD5,train$Label )
Confusion Matrix and Statistics

          Reference
Prediction HIGH LOW MEDIUM
    HIGH    119   0      0
    LOW       1 120      3
    MEDIUM    1   1    233

Overall Statistics

               Accuracy : 0.9874          
                 95% CI : (0.9729, 0.9954)
    No Information Rate : 0.4937          
    P-Value [Acc > NIR] : <2e-16          

                  Kappa : 0.98            

 Mcnemar's Test P-Value : 0.3916          

Statistics by Class:

                     Class: HIGH Class: LOW Class: MEDIUM
Sensitivity               0.9835     0.9917        0.9873
Specificity               1.0000     0.9888        0.9917
Pos Pred Value            1.0000     0.9677        0.9915
Neg Pred Value            0.9944     0.9972        0.9877
Prevalence                0.2531     0.2531        0.4937
Detection Rate            0.2490     0.2510        0.4874
Detection Prevalence      0.2490     0.2594        0.4916
Balanced Accuracy         0.9917     0.9903        0.9895

Viewing all articles
Browse latest Browse all 201867

Trending Articles