Whether the Y is a "classification", "regression" or ill-defined problem.
Returns a character: "classification", "regression", or an error for strange
classes. Minor redundancy with is_discrete, though explicit. Could be useful
for DALEX::explain(type) as it also expects "classification" or
"regression".
Value
Character either c("classification", "regression") specifying the assumed model task based on the discreteness of y.
See also
Other cheem utility:
as_logical_index(),
color_scale_of(),
contains_nonnumeric(),
is_discrete(),
is_diverging(),
linear_tform(),
logistic_tform(),
sug_basis(),
sug_manip_var()
Examples
library(cheem)
problem_type(mtcars$mpg) ## Numeric, many values
#> [1] "regression"
problem_type(mtcars$cyl) ## Numeric column, labeled as discrete, because less than 25 unique values
#> [1] "classification"
problem_type(letters) ## Character to classification
#> [1] "classification"
problem_type(factor(letters)) ## Factor to classification
#> [1] "classification"