problem_type: The type of model for a given Y variable

View source: R/0_util.r

problem_typeR Documentation

The type of model for a given Y variable

Description

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".

Usage

problem_type(y)

Arguments

y

Response variable to be modeled

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(), rnorm_from(), sug_basis(), sug_manip_var()

Examples

library(cheem)

problem_type(mtcars$mpg) ## Numeric, many values
problem_type(mtcars$cyl) ## Numeric column, labeled as discrete, because less than 25 unique values
problem_type(letters) ## Character to classification
problem_type(factor(letters)) ## Factor to classification

cheem documentation built on Nov. 9, 2023, 1:08 a.m.