我有一个带有分类变量的数据集,我想在sparklyr
中使用一键编码进行编码。下面是表头以及我正在使用的代码:
tbl_name %>%
ft_one_hot_encoder(input_col="category",output_col="category_x")
但是,出现以下错误:java.lang.IllegalArgumentException: requirement failed: Input column must be of type numeric but got string
。我可能在这里丢失了一些内容,但是一键编码器的输入列怎么能是数字呢?
阅读卢拉斯基的书,在ft_string_indexer()
中应用ft_one_hot_encoder()
之前需要使用sparklyr
。