Skip to content

Problem in chapter 5 : Master Spark with RΒ #91

@FluffyPanda0310

Description

@FluffyPanda0310

Hi,
In chapter 5 : Master Spark with R, when I try to run these code, it worked

okc_train %>%
ft_string_indexer(input_col = "sex", output_col = "sex_indexed") %>%
ft_string_indexer(input_col = "drinks", output_col = "drinks_indexed") %>%
ft_string_indexer(input_col = "drugs", output_col = "drugs_indexed") %>%
select(age, sex_indexed, drinks_indexed, drugs_indexed, essay_length) %>%
ft_one_hot_encoder_estimator(
input_cols = c("sex_indexed", "drinks_indexed", "drugs_indexed"),
output_cols = c("sex_encoded", "drinks_encoded", "drugs_encoded")
)

But the original one :

pipeline <- ml_pipeline(sc) %>%
ft_string_indexer(input_col = "sex", output_col = "sex_indexed") %>%
ft_string_indexer(input_col = "drinks", output_col = "drinks_indexed") %>%
ft_string_indexer(input_col = "drugs", output_col = "drugs_indexed") %>%
ft_one_hot_encoder_estimator(
input_cols = c("sex_indexed", "drinks_indexed", "drugs_indexed"),
output_cols = c("sex_encoded", "drinks_encoded", "drugs_encoded"))
pipeline_model <- ml_fit(pipeline, okc_train)

gave out the error :

Error in as.character(call[[1]]) :
cannot coerce type 'closure' to vector of type 'character'

I don't know where the error comes from, since the vectors are all in numeric not in character.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions