【发布时间】:2016-08-02 16:52:16
【问题描述】:
问题是关于 Logistic regression with spark ml (data frames)
当我想将代码 Python 更改为 Scala 时
Python:
[stage.coefficients for stage in model.stages
if isinstance(stage, LogisticRegressionModel)]
斯卡拉:(改变)
for (stage<-model.stages){
if(stage.isInstanceOf[LogisticRegressionModel]{
val a = Array(stage.coefficients)
}}
我已经检查了stage.isInstanceOf[LogisticRegressionModel],它返回了 True。但是,stage.coefficients 有错误消息。它说"value coefficients is not a member of org.apache.spark.ml.Transformer"。
我只检查舞台,它会返回
org.apache.spark.ml.Transformer= logreg 382456482
为什么isInstanceOf返回true时类型不同?我该怎么办?谢谢
【问题讨论】:
标签: python scala apache-spark apache-spark-ml