The question is about Logistic regression with spark ml (data frames)
When I want to change the code Python to Scala
Python:
[stage.coefficients for stage in model.stages
if isinstance(stage, LogisticRegressionModel)]
Scala:(changed)
for (stage<-model.stages){
if(stage.isInstanceOf[LogisticRegressionModel]{
val a = Array(stage.coefficients)
}}
I have already checked stage.isInstanceOf[LogisticRegressionModel], which returned the True. However, stage.coefficients has the error message. It says "value coefficients is not a member of org.apache.spark.ml.Transformer".
I only check the stage, it will return
org.apache.spark.ml.Transformer= logreg 382456482
Why the type is different when the isInstanceOf returns true? What should I do? Thanks