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

    https://github.com/apache/spark/pull/11119#discussion_r82750575
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/clustering/KMeans.scala 
---
    @@ -333,13 +372,44 @@ class KMeans @Since("1.5.0") (
       override def transformSchema(schema: StructType): StructType = {
         validateAndTransformSchema(schema)
       }
    +
    +  @Since("2.1.0")
    +  override def write: MLWriter = new KMeans.KMeansWriter(this)
     }
     
     @Since("1.6.0")
     object KMeans extends DefaultParamsReadable[KMeans] {
     
    +  // TODO: [SPARK-17784]: Add a fromCenters method
    +
       @Since("1.6.0")
       override def load(path: String): KMeans = super.load(path)
    +
    +  @Since("1.6.0")
    +  override def read: MLReader[KMeans] = new KMeansReader
    +
    +  /** [[MLWriter]] instance for [[KMeans]] */
    +  private[KMeans] class KMeansWriter(instance: KMeans) extends MLWriter {
    +    override protected def saveImpl(path: String): Unit = {
    +      DefaultParamsWriter.saveInitialModel(instance, path)
    +      DefaultParamsWriter.saveMetadata(instance, path, sc)
    +    }
    +  }
    +
    +  private class KMeansReader extends MLReader[KMeans] {
    +
    +    /** Checked against metadata when loading model */
    --- End diff --
    
    nit - should this be "... when loading estimator"?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to