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

    https://github.com/apache/spark/pull/4986#discussion_r27068181
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/mllib/clustering/GaussianMixtureModel.scala
 ---
    @@ -83,5 +95,81 @@ class GaussianMixtureModel(
           p(i) /= pSum
         }
         p
    -  }  
    +  }
    +}
    +
    +@Experimental
    +object GaussianMixtureModel extends Loader[GaussianMixtureModel] {
    +
    +  private object SaveLoadV1_0 {
    +
    +    case class Data(weight: Double, mu: Vector, sigma: Matrix)
    +
    +    def formatVersionV1_0 = "1.0"
    +
    +    def classNameV1_0 = 
"org.apache.spark.mllib.clustering.GaussianMixtureModel"
    +
    +    def save(
    +        sc: SparkContext,
    +        path: String,
    +        weights: Array[Double],
    +        gaussians: Array[MultivariateGaussian]): Unit = {
    +
    +      val sqlContext = new SQLContext(sc)
    +      import sqlContext.implicits._
    +
    +      // Create JSON metadata.
    +      val metadata = compact(render
    +        (("class" -> classNameV1_0) ~ ("version" -> formatVersionV1_0) ~ 
("k" -> weights.length)))
    +      sc.parallelize(Seq(metadata), 
1).saveAsTextFile(Loader.metadataPath(path))
    +
    +      // Create Parquet data.
    +      val dataArray = Array.tabulate(weights.length){ i =>
    --- End diff --
    
    space bofore `{`


---
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