Creates bucketized columns

    Use this step to create bucketized columns from numeric columns.

    step_bucketized_column(spec, ..., boundaries)

    Arguments

    spec

    A feature specification created with feature_spec().

    ...

    Comma separated list of variable names to apply the step. selectors can also be used.

    boundaries

    A sorted list or tuple of floats specifying the boundaries.

    Value

    a FeatureSpec object.

    See also

    Examples

    if (FALSE) { library(tfdatasets) data(hearts) file <- tempfile() writeLines(unique(hearts$thal), file) hearts <- tensor_slices_dataset(hearts) %>% dataset_batch(32) # use the formula interface spec <- feature_spec(hearts, target ~ age) %>% step_numeric_column(age) %>% step_bucketized_column(age, boundaries = c(10, 20, 30)) spec_fit <- fit(spec) final_dataset <- hearts %>% dataset_use_spec(spec_fit) }