Skip to content

Commit de88664

Browse files
authored
merge pr #782: fix dbarts class prediction order
2 parents 3022416 + b065e03 commit de88664

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

R/bart.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ dbart_predict_calc <- function(obj, new_data, type, level = 0.95, std_err = FALS
196196
res <- tibble::tibble(.pred = apply(post_dist, 2, mean, na.rm = TRUE))
197197
} else if (type == "class") {
198198
mn <- apply(post_dist, 2, mean, na.rm = TRUE)
199-
lvl <- ifelse(mn > 0.5, obj$lvl[1], obj$lvl[2])
199+
lvl <- ifelse(mn > 0.5, obj$lvl[2], obj$lvl[1])
200200
lvl <- factor(lvl, levels = obj$lvl)
201201
res <- tibble::tibble(.pred_class = lvl)
202202
} else if (type == "prob") {

0 commit comments

Comments
 (0)