Repository: spark Updated Branches: refs/heads/branch-1.4 e5a994f21 -> 4b5bbc589
Revert "[SPARK-8481] [MLLIB] GaussianMixtureModel.predict, GaussianMixtureModel.predictSoft variants for a single vector" This reverts commit 07f778978d80f0af57d3dafda4c566a813ad2d09. Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/4b5bbc58 Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/4b5bbc58 Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/4b5bbc58 Branch: refs/heads/branch-1.4 Commit: 4b5bbc589e11d882c993a3e6daeb0cdad9789e76 Parents: e5a994f Author: Joseph K. Bradley <joseph.kurata.brad...@gmail.com> Authored: Fri Aug 7 13:42:20 2015 -0700 Committer: Joseph K. Bradley <joseph.kurata.brad...@gmail.com> Committed: Fri Aug 7 13:42:20 2015 -0700 ---------------------------------------------------------------------- .../spark/mllib/clustering/GaussianMixtureModel.scala | 13 ------------- .../spark/mllib/clustering/GaussianMixtureSuite.scala | 10 ---------- 2 files changed, 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/4b5bbc58/mllib/src/main/scala/org/apache/spark/mllib/clustering/GaussianMixtureModel.scala ---------------------------------------------------------------------- diff --git a/mllib/src/main/scala/org/apache/spark/mllib/clustering/GaussianMixtureModel.scala b/mllib/src/main/scala/org/apache/spark/mllib/clustering/GaussianMixtureModel.scala index 76aeebd..cb807c8 100644 --- a/mllib/src/main/scala/org/apache/spark/mllib/clustering/GaussianMixtureModel.scala +++ b/mllib/src/main/scala/org/apache/spark/mllib/clustering/GaussianMixtureModel.scala @@ -66,12 +66,6 @@ class GaussianMixtureModel( responsibilityMatrix.map(r => r.indexOf(r.max)) } - /** Maps given point to its cluster index. */ - def predict(point: Vector): Int = { - val r = computeSoftAssignments(point.toBreeze.toDenseVector, gaussians, weights, k) - r.indexOf(r.max) - } - /** Java-friendly version of [[predict()]] */ def predict(points: JavaRDD[Vector]): JavaRDD[java.lang.Integer] = predict(points.rdd).toJavaRDD().asInstanceOf[JavaRDD[java.lang.Integer]] @@ -90,13 +84,6 @@ class GaussianMixtureModel( } /** - * Given the input vector, return the membership values to all mixture components. - */ - def predictSoft(point: Vector): Array[Double] = { - computeSoftAssignments(point.toBreeze.toDenseVector, gaussians, weights, k) - } - - /** * Compute the partial assignments for each vector */ private def computeSoftAssignments( http://git-wip-us.apache.org/repos/asf/spark/blob/4b5bbc58/mllib/src/test/scala/org/apache/spark/mllib/clustering/GaussianMixtureSuite.scala ---------------------------------------------------------------------- diff --git a/mllib/src/test/scala/org/apache/spark/mllib/clustering/GaussianMixtureSuite.scala b/mllib/src/test/scala/org/apache/spark/mllib/clustering/GaussianMixtureSuite.scala index b636d02..b218d72 100644 --- a/mllib/src/test/scala/org/apache/spark/mllib/clustering/GaussianMixtureSuite.scala +++ b/mllib/src/test/scala/org/apache/spark/mllib/clustering/GaussianMixtureSuite.scala @@ -148,16 +148,6 @@ class GaussianMixtureSuite extends SparkFunSuite with MLlibTestSparkContext { } } - test("model prediction, parallel and local") { - val data = sc.parallelize(GaussianTestData.data) - val gmm = new GaussianMixture().setK(2).setSeed(0).run(data) - - val batchPredictions = gmm.predict(data) - batchPredictions.zip(data).collect().foreach { case (batchPred, datum) => - assert(batchPred === gmm.predict(datum)) - } - } - object GaussianTestData { val data = Array( --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org