클래스 확률과 예측

R의 caret로 배우는 Machine Learning

Zach Mayer

Data Scientist at DataRobot and co-author of caret

다른 임계값

  • 임계값은 50%로 고정되지 않음
    • 10%: 더 많은 지뢰를 잡지만 확신은 낮음
    • 90%: 더 적게 잡지만 확신은 높음
  • 진양성·위양성의 균형 조정
  • 비용-편익 분석
R의 caret로 배우는 Machine Learning

혼동 행렬

# Use a larger cutoff
p_class <- ifelse(p > 0.99, "M", "R")
table(p_class)
p_class
 M  R 
41 42 
# Make simple 2-way frequency table
table(p_class, test[["Class"]])
p_class  M  R
      M 13 28
      R 30 12
R의 caret로 배우는 Machine Learning

caret로 본 혼동 행렬

# Use caret to produce confusion matrix
confusionMatrix(p_class, test[["Class"]])
          Reference
Prediction  M  R
         M 13 28
         R 30 12

               Accuracy : 0.3012          
                 95% CI : (0.2053, 0.4118)
    No Information Rate : 0.5181          
    P-Value [Acc > NIR] : 1.0000          

                  Kappa : -0.397          
 Mcnemar's Test P-Value : 0.8955          

            Sensitivity : 0.3023          
            Specificity : 0.3000          
         Pos Pred Value : 0.3171          
         Neg Pred Value : 0.2857
R의 caret로 배우는 Machine Learning

연습해 봅시다!

R의 caret로 배우는 Machine Learning

Preparing Video For Download...