Skip to content

class probabibility confidence intervals - #32

Open
corybrunson wants to merge 8 commits into
mainfrom
conf-int
Open

corybrunson wants to merge 8 commits into
mainfrom
conf-int

Conversation

@corybrunson

Copy link
Copy Markdown
Owner

Only one engine (clm from {ordinal}) natively supports confidence intervals for class probabilities, but my sense is that they're in high demand so users will be glad to have the option.

Base automatically changed from parallel-reg to main November 9, 2026 22:18
@corybrunson

Copy link
Copy Markdown
Owner Author

@topepo i think this is the first attempt at a 'conf_int' method for multi-class prediction—sorry if i missed some—so i want to check with the tidymodels team about the output format before merging. Below is a reproducible example. (This requires no changes to parsnip.)

library(MASS)
library(ordered)
#> Loading required package: parsnip
set.seed(581837)

house_sub <- MASS::housing %>%
  dplyr::sample_n(size = 120, replace = TRUE, weight = Freq) %>%
  subset(select = -Freq)
train_inds <- sample(120, 80)
house_train <- house_sub[train_inds, ]
house_test <- house_sub[-train_inds, ]

ordinal_reg() |>
  set_engine("clm") |>
  set_mode("classification") |> 
  fit(Sat ~ Infl + Type + Cont, data = house_train) |> 
  predict(new_data = house_test, type = "conf_int")
#> # A tibble: 40 × 6
#>    .pred_lower_Low .pred_upper_Low .pred_lower_Medium .pred_upper_Medium
#>              <dbl>           <dbl>              <dbl>              <dbl>
#>  1         0.112            0.443              0.220               0.479
#>  2         0.112            0.443              0.220               0.479
#>  3         0.187            0.811              0.166               0.510
#>  4         0.0122           0.246              0.0451              0.419
#>  5         0.283            0.727              0.188               0.464
#>  6         0.00480          0.0985             0.0186              0.219
#>  7         0.283            0.727              0.188               0.464
#>  8         0.283            0.727              0.188               0.464
#>  9         0.187            0.811              0.166               0.510
#> 10         0.315            0.910              0.0764              0.491
#> # ℹ 30 more rows
#> # ℹ 2 more variables: .pred_lower_High <dbl>, .pred_upper_High <dbl>

Created on 2026-11-14 with reprex v2.1.1

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant