Skip to content

Commit 21bfa4b

Browse files
committed
close #121
1 parent 79e8ba1 commit 21bfa4b

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Bug fixes
44

55
* Fixed issue in `performance_accuracy()` for binomial models when response variable had non-numeric factor levels.
6+
* Fixed issues in `performance_roc()`, which printed 1 - AUC instead of AUC.
67

78
# performance 0.4.6
89

R/performance_accuracy.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ performance_accuracy <- function(model, method = c("cv", "boot"), k = 5, n = 100
121121

122122
accuracy <- mapply(function(.x, .y) {
123123
roc <- performance_roc(x = .x, predictions = .y)
124-
bayestestR::area_under_curve(roc$Sensivity, roc$Specifity)
124+
bayestestR::area_under_curve(roc$Specifity, roc$Sensivity)
125125
}, response, predictions)
126126
} else {
127127

@@ -142,7 +142,7 @@ performance_accuracy <- function(model, method = c("cv", "boot"), k = 5, n = 100
142142

143143
accuracy <- mapply(function(.x, .y) {
144144
roc <- performance_roc(x = .x, predictions = .y)
145-
bayestestR::area_under_curve(roc$Sensivity, roc$Specifity)
145+
bayestestR::area_under_curve(roc$Specifity, roc$Sensivity)
146146
}, response, predictions)
147147
}
148148
}

R/performance_roc.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#' performance_roc(model, new_data = test_data)
3333
#'
3434
#' roc <- performance_roc(model, new_data = test_data)
35-
#' area_under_curve(roc$Sensivity, roc$Specifity)
35+
#' area_under_curve(roc$Specifity, roc$Sensivity)
3636
#'
3737
#' m1 <- glm(y ~ Sepal.Length + Sepal.Width, data = iris, family = "binomial")
3838
#' m2 <- glm(y ~ Sepal.Length + Petal.Width, data = iris, family = "binomial")

R/print-methods.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ print.check_distribution_numeric <- function(x, ...) {
115115
#' @export
116116
print.performance_roc <- function(x, ...) {
117117
if (length(unique(x$Model)) == 1) {
118-
cat(sprintf("AUC: %.2f%%\n", 100 * bayestestR::area_under_curve(x$Sensivity, x$Specifity)))
118+
cat(sprintf("AUC: %.2f%%\n", 100 * bayestestR::area_under_curve(x$Specifity, x$Sensivity)))
119119
} else {
120120
insight::print_color("# Area under Curve\n\n", "blue")
121121

@@ -127,7 +127,7 @@ print.performance_roc <- function(x, ...) {
127127
" %*s: %.2f%%\n",
128128
max_space,
129129
names(dat)[i],
130-
100 * bayestestR::area_under_curve(dat[[i]]$Sensivity, dat[[i]]$Specifity)
130+
100 * bayestestR::area_under_curve(dat[[i]]$Specifity, dat[[i]]$Sensivity)
131131
))
132132
}
133133
}

0 commit comments

Comments
 (0)