Github user WeichenXu123 commented on a diff in the pull request: https://github.com/apache/spark/pull/19208#discussion_r141356070 --- Diff: mllib/src/main/scala/org/apache/spark/ml/tuning/CrossValidator.scala --- @@ -261,17 +290,40 @@ class CrossValidatorModel private[ml] ( val copied = new CrossValidatorModel( uid, bestModel.copy(extra).asInstanceOf[Model[_]], - avgMetrics.clone()) + avgMetrics.clone(), + CrossValidatorModel.copySubModels(subModels)) copyValues(copied, extra).setParent(parent) } @Since("1.6.0") override def write: MLWriter = new CrossValidatorModel.CrossValidatorModelWriter(this) + + @Since("2.3.0") + @throws[IOException]("If the input path already exists but overwrite is not enabled.") + def save(path: String, persistSubModels: Boolean): Unit = { + write.asInstanceOf[CrossValidatorModel.CrossValidatorModelWriter] + .persistSubModels(persistSubModels).save(path) + } --- End diff -- I tried `model.write.asInstanceOf[CrossValidatorModel.CrossValidatorModelWriter]` but cannot pass complier, it is inaccessible. Do you have some other ways ?
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org