Obtain names of prediction columns for a fitted model or workflow
Source:R/misc.R
dot-get_prediction_column_names.Rd
.get_prediction_column_names()
returns a list that has the names of the
columns for the primary prediction types for a model.
Examples
library(dplyr)
library(modeldata)
data("two_class_dat")
levels(two_class_dat$Class)
#> [1] "Class1" "Class2"
lr_fit <- logistic_reg() %>% fit(Class ~ ., data = two_class_dat)
.get_prediction_column_names(lr_fit)
#> $estimate
#> [1] ".pred_class"
#>
#> $probabilities
#> [1] ".pred_Class1" ".pred_Class2"
#>
.get_prediction_column_names(lr_fit, syms = TRUE)
#> $estimate
#> $estimate[[1]]
#> .pred_class
#>
#>
#> $probabilities
#> $probabilities[[1]]
#> .pred_Class1
#>
#> $probabilities[[2]]
#> .pred_Class2
#>
#>