首页 > 解决方案 > 在 sparklyr 中使用 ft_one_hot_encoder() 时出错

问题描述

我有一个带有分类变量的数据集,我想在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. 我可能在这里遗漏了一些东西,但是 one-hot 编码器的输入列怎么可能是数字的呢?

标签: rapache-sparksparklyrone-hot-encoding

解决方案


在申请之前阅读 Luraschi 的ft_string_indexer()需要使用ft_one_hot_encoder()的书sparklyr


推荐阅读