Skip to contents

Calculate all measures for sparse ROC

Usage

getThresholdSummary(
  prediction,
  predictionType = "binary",
  typeColumn = "evaluation"
)

Arguments

prediction

A prediction object

predictionType

The type of prediction (binary or survival)

typeColumn

A column that is used to stratify the results

Value

A data.frame with TP, FP, TN, FN, TPR, FPR, accuracy, PPF, FOR and Fmeasure

Details

Calculates the TP, FP, TN, FN, TPR, FPR, accuracy, PPF, FOR and Fmeasure from a prediction object

Examples

prediction <- data.frame(rowId = 1:100, 
                         outcomeCount = stats::rbinom(1:100, 1, prob=0.5),
                         value = runif(100), 
                         evaluation = rep("Train", 100))
summary <- getThresholdSummary(prediction)
str(summary)
#> 'data.frame':	100 obs. of  24 variables:
#>  $ evaluation             : chr  "Train" "Train" "Train" "Train" ...
#>  $ predictionThreshold    : num  0.998 0.947 0.913 0.909 0.907 ...
#>  $ preferenceThreshold    : num  0.998 0.938 0.899 0.895 0.893 ...
#>  $ positiveCount          : num  1 2 3 4 5 6 7 8 9 10 ...
#>  $ negativeCount          : num  99 98 97 96 95 94 93 92 91 90 ...
#>  $ trueCount              : num  54 54 54 54 54 54 54 54 54 54 ...
#>  $ falseCount             : num  46 46 46 46 46 46 46 46 46 46 ...
#>  $ truePositiveCount      : num  1 2 3 4 4 4 5 5 6 6 ...
#>  $ trueNegativeCount      : num  46 46 46 46 45 44 44 43 43 42 ...
#>  $ falsePositiveCount     : num  0 0 0 0 1 2 2 3 3 4 ...
#>  $ falseNegativeCount     : num  53 52 51 50 50 50 49 49 48 48 ...
#>  $ f1Score                : num  0.0364 0.0714 0.1053 0.1379 0.1356 ...
#>  $ accuracy               : num  0.47 0.48 0.49 0.5 0.49 0.48 0.49 0.48 0.49 0.48 ...
#>  $ sensitivity            : num  0.0185 0.037 0.0556 0.0741 0.0741 ...
#>  $ falseNegativeRate      : num  0.981 0.963 0.944 0.926 0.926 ...
#>  $ falsePositiveRate      : num  0 0 0 0 0.0217 ...
#>  $ specificity            : num  1 1 1 1 0.978 ...
#>  $ positivePredictiveValue: num  1 1 1 1 0.8 ...
#>  $ falseDiscoveryRate     : num  0 0 0 0 0.2 ...
#>  $ negativePredictiveValue: num  0.465 0.469 0.474 0.479 0.474 ...
#>  $ falseOmissionRate      : num  0.535 0.531 0.526 0.521 0.526 ...
#>  $ positiveLikelihoodRatio: num  Inf Inf Inf Inf 3.41 ...
#>  $ negativeLikelihoodRatio: num  0.981 0.963 0.944 0.926 0.947 ...
#>  $ diagnosticOddsRatio    : num  Inf Inf Inf Inf 3.6 ...