Github user smurching commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19208#discussion_r139573779
  
    --- 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 think users can still access `CrossValidatorModelWriter` through 
`CrossValidatorModel.write`, so the `save` method is unnecessary. 
    
    The `private[CrossValidatorModel]` annotation on the 
`CrossValidatorModelWriter` constructor only means that users can't create 
instances of the class e.g. via `new 
CrossValidatorModel.CrossValidatorModelWriter(...)`


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to