Skip to content

.get_prediction_column_names() returns a list that has the names of the columns for the primary prediction types for a model.

Usage

.get_prediction_column_names(x, syms = FALSE)

Arguments

x

A fitted model (class "model_fit") or a fitted workflow.

syms

Should the column names be converted to symbols?

Value

A list with elements "estimate" and "probabilities".

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
#> 
#>