首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >无法使用pyspark保存pyspark iforest模型

无法使用pyspark保存pyspark iforest模型
EN

Stack Overflow用户
提问于 2019-06-27 21:17:43
回答 1查看 302关注 0票数 0

如下所述使用iforest:https://github.com/titicaca/spark-iforest,但model.save()抛出异常。

遵循所提到的git页面上"Python API“部分中提到的代码片段。

从pyspark.ml.feature导入VectorAssembler导入os从pyspark_iforest.ml.iforest导入临时文件导入*

col_1:integer col_2:integer col_3:integer

汇编程序= VectorAssembler(inputCols=in_cols,outputCol="features") featurized = assembler.transform(df)

iforest = IForest(contamination=0.5,maxDepth=2) model=iforest.fit(df)

model.save("model_path")异常: scala.NotImplementedError:默认jsonEncode只支持字符串、向量和矩阵。org.apache.spark.ml.param.Param必须为java.lang.Double重写jsonEncode。

下面是我在执行"model.transform(df)“之后得到的输出数据帧。model.save()应该能够保存模型文件。col_1:integer col_2:integer col_3:integer功能:udt异常得分:双预测:双预测

EN

回答 1

Stack Overflow用户

发布于 2019-07-02 17:58:51

我刚刚修复了这个问题。这是由不正确的参数类型引起的。您可以在主分支中检出最新的代码,然后重试。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56791931

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档