Github user jkbradley commented on a diff in the pull request: https://github.com/apache/spark/pull/19208#discussion_r148859168 --- Diff: mllib/src/main/scala/org/apache/spark/ml/tuning/CrossValidator.scala --- @@ -252,19 +252,29 @@ object CrossValidator extends MLReadable[CrossValidator] { class CrossValidatorModel private[ml] ( @Since("1.4.0") override val uid: String, @Since("1.2.0") val bestModel: Model[_], - @Since("1.5.0") val avgMetrics: Array[Double], - @Since("2.3.0") val subModels: Option[Array[Array[Model[_]]]]) + @Since("1.5.0") val avgMetrics: Array[Double]) extends Model[CrossValidatorModel] with CrossValidatorParams with MLWritable { /** A Python-friendly auxiliary constructor. */ private[ml] def this(uid: String, bestModel: Model[_], avgMetrics: JList[Double]) = { - this(uid, bestModel, avgMetrics.asScala.toArray, null) + this(uid, bestModel, avgMetrics.asScala.toArray) } - private[ml] def this(uid: String, bestModel: Model[_], avgMetrics: Array[Double]) = { - this(uid, bestModel, avgMetrics, null) + private var _subModels: Option[Array[Array[Model[_]]]] = None + + @Since("2.3.0") + private[tuning] def setSubModels(subModels: Option[Array[Array[Model[_]]]]) + : CrossValidatorModel = { + _subModels = subModels + this } + @Since("2.3.0") + def subModels: Array[Array[Model[_]]] = _subModels.get --- End diff -- Let's add Scala doc. We'll need to explain what the inner and outer array are and which one corresponds to the ordering of estimatorParamsMaps.
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org