Github user huaxingao commented on the issue:

    https://github.com/apache/spark/pull/22790
  
    I added a regression test in 
```org.apache.spark.mllib.clustering.BisectingKMeansSuite``` 
    I could  add the following test in ml package. 
    ```
      test("SPARK-25793") {
        val bisectingKMeans = new BisectingKMeans()
        bisectingKMeans.setDistanceMeasure(DistanceMeasure.COSINE)
        val readBisectingKMeans = testDefaultReadWrite(bisectingKMeans)
        assert(bisectingKMeans.distanceMeasure === 
readBisectingKMeans.distanceMeasure)
      }
    ```
    But the bug doesn't really affect the above test. With the bug, even though 
mllib ```BisectingKMeansModel.load``` will call V1_0 load and gives a model 
with default value of distanceMeasure, in ml package, 
```BisectingKMeansModelReader.load``` will call 
```metadata.getAndSetParams(model)``` which will set the distanceMeasure to the 
correct value (DistanceMeasure.COSINE).
    ```
        override def load(path: String): BisectingKMeansModel = {
          val metadata = DefaultParamsReader.loadMetadata(path, sc, className)
          val dataPath = new Path(path, "data").toString
          val mllibModel = MLlibBisectingKMeansModel.load(sc, dataPath)
          val model = new BisectingKMeansModel(metadata.uid, mllibModel)
          metadata.getAndSetParams(model)
          model
        }
    ```


---

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

Reply via email to