You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by yh...@apache.org on 2016/01/07 07:03:38 UTC
spark git commit: Revert "[SPARK-12006][ML][PYTHON] Fix GMM failure
if initialModel is not None"
Repository: spark
Updated Branches:
refs/heads/master b67385203 -> e5cde7ab1
Revert "[SPARK-12006][ML][PYTHON] Fix GMM failure if initialModel is not None"
This reverts commit fcd013cf70e7890aa25a8fe3cb6c8b36bf0e1f04.
Author: Yin Huai <yh...@databricks.com>
Closes #10632 from yhuai/pythonStyle.
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/e5cde7ab
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/e5cde7ab
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/e5cde7ab
Branch: refs/heads/master
Commit: e5cde7ab11a43334fa01b1bb8904da5c0774bc62
Parents: b673852
Author: Yin Huai <yh...@databricks.com>
Authored: Wed Jan 6 22:03:31 2016 -0800
Committer: Yin Huai <yh...@databricks.com>
Committed: Wed Jan 6 22:03:31 2016 -0800
----------------------------------------------------------------------
python/pyspark/mllib/clustering.py | 2 +-
python/pyspark/mllib/tests.py | 12 ------------
2 files changed, 1 insertion(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/e5cde7ab/python/pyspark/mllib/clustering.py
----------------------------------------------------------------------
diff --git a/python/pyspark/mllib/clustering.py b/python/pyspark/mllib/clustering.py
index 48daa87..c9e6f1d 100644
--- a/python/pyspark/mllib/clustering.py
+++ b/python/pyspark/mllib/clustering.py
@@ -346,7 +346,7 @@ class GaussianMixture(object):
if initialModel.k != k:
raise Exception("Mismatched cluster count, initialModel.k = %s, however k = %s"
% (initialModel.k, k))
- initialModelWeights = list(initialModel.weights)
+ initialModelWeights = initialModel.weights
initialModelMu = [initialModel.gaussians[i].mu for i in range(initialModel.k)]
initialModelSigma = [initialModel.gaussians[i].sigma for i in range(initialModel.k)]
java_model = callMLlibFunc("trainGaussianMixtureModel", rdd.map(_convert_to_vector),
http://git-wip-us.apache.org/repos/asf/spark/blob/e5cde7ab/python/pyspark/mllib/tests.py
----------------------------------------------------------------------
diff --git a/python/pyspark/mllib/tests.py b/python/pyspark/mllib/tests.py
index 97fed76..6ed03e3 100644
--- a/python/pyspark/mllib/tests.py
+++ b/python/pyspark/mllib/tests.py
@@ -475,18 +475,6 @@ class ListTests(MLlibTestCase):
for c1, c2 in zip(clusters1.weights, clusters2.weights):
self.assertEqual(round(c1, 7), round(c2, 7))
- def test_gmm_with_initial_model(self):
- from pyspark.mllib.clustering import GaussianMixture
- data = self.sc.parallelize([
- (-10, -5), (-9, -4), (10, 5), (9, 4)
- ])
-
- gmm1 = GaussianMixture.train(data, 2, convergenceTol=0.001,
- maxIterations=10, seed=63)
- gmm2 = GaussianMixture.train(data, 2, convergenceTol=0.001,
- maxIterations=10, seed=63, initialModel=gmm1)
- self.assertAlmostEqual((gmm1.weights - gmm2.weights).sum(), 0.0)
-
def test_classification(self):
from pyspark.mllib.classification import LogisticRegressionWithSGD, SVMWithSGD, NaiveBayes
from pyspark.mllib.tree import DecisionTree, DecisionTreeModel, RandomForest,\
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org