python - Pyspark 与一个热编码列的相关性
问题描述
我是 pyspark 的新手。
我想计算 acolumn(int)
与 another之间的相关性column(vector from onehotencoder)
。
我使用这段代码:
import six
for i in df.columns:
if not(isinstance(df.select(i).take(1)[0][0], six.string_types)):
print( "Correlation to label for", i, df.stat.corr('label',i))
当计算标签 onehotencoder 列之间的相关性时出现此错误:
Py4JJavaError: An error occurred while calling o9219.corr. :
java.lang.IllegalArgumentException:
requirement failed:
Currently correlation calculation for columns with dataType org.apache.spark.ml.linalg.VectorUDT@3bfc3ba7 not supported
解决方案
推荐阅读
- php - Google oauth2 服务 api 密钥无效
- javascript - Javascript 对象选项:function 或 null
- seal - SEAL 代码中的刷新和有效性检查操作
- css - react-select V2 - 如何在 `isMulti` `ValueContainer` 上实现 `overflow-x: hidden`
- spring - TestExecutionListener 根本没有在听
- php - 使用 regExp 将电话号码转换为美国类型的电话号码也用于分机号码
- c# - 使用 SQL 命令从 C# 中的数据库中检索信息
- django - 在 django rest 框架中为 post 调用 save() 的问题
- c++ - if constexpr 和 C4702(以及 C4100 和 C4715)
- gcc - 如何让 GCC 生成 ELF 目标文件?