r - 在 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 编码器的输入列怎么可能是数字的呢?
解决方案
在申请之前阅读 Luraschi 的ft_string_indexer()
需要使用ft_one_hot_encoder()
的书sparklyr
。
推荐阅读
- python - 为什么 bar.py 中的 print(sys.modules['__main__']) 会产生相同的输出?
- ironpython - Spotfire - 通过 IronPython 根据文档属性值在表中标记行
- node.js - AbortError:Redis 连接丢失并且命令中止。可能已经处理
- z3 - 调整 Z3 量词实例化的指南(使用 SMT-LIB 接口)
- python - 如何指定可以是整数或字符串的类型
- sql-server - MS SQL Server 更新外键
- node.js - 指的是哪个证书?
- python - 直播 RTSP 到 html 所有浏览器
- javascript - 打字稿递归箭头函数类型
- javascript - 是否可以在 XHTML 1.0 上使用 Google Analytics?