Repository: spark
Updated Branches:
  refs/heads/master f15806a8f -> acffc4345


[SPARK-6262][MLLIB]Implement missing methods for MultivariateStatisticalSummary

Add below methods in pyspark for MultivariateStatisticalSummary
- normL1
- normL2

Author: lewuathe <lewua...@me.com>

Closes #5359 from Lewuathe/SPARK-6262 and squashes the following commits:

cbe439e [lewuathe] Implement missing methods for MultivariateStatisticalSummary


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/acffc434
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/acffc434
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/acffc434

Branch: refs/heads/master
Commit: acffc43455d7b3e4000be4ff0175b8ea19cd280b
Parents: f15806a
Author: lewuathe <lewua...@me.com>
Authored: Sun Apr 5 16:13:31 2015 -0700
Committer: Xiangrui Meng <m...@databricks.com>
Committed: Sun Apr 5 16:13:31 2015 -0700

----------------------------------------------------------------------
 python/pyspark/mllib/stat/_statistics.py | 6 ++++++
 python/pyspark/mllib/tests.py            | 6 ++++++
 2 files changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/acffc434/python/pyspark/mllib/stat/_statistics.py
----------------------------------------------------------------------
diff --git a/python/pyspark/mllib/stat/_statistics.py 
b/python/pyspark/mllib/stat/_statistics.py
index 218ac14..1d83e9d 100644
--- a/python/pyspark/mllib/stat/_statistics.py
+++ b/python/pyspark/mllib/stat/_statistics.py
@@ -49,6 +49,12 @@ class MultivariateStatisticalSummary(JavaModelWrapper):
     def min(self):
         return self.call("min").toArray()
 
+    def normL1(self):
+        return self.call("normL1").toArray()
+
+    def normL2(self):
+        return self.call("normL2").toArray()
+
 
 class Statistics(object):
 

http://git-wip-us.apache.org/repos/asf/spark/blob/acffc434/python/pyspark/mllib/tests.py
----------------------------------------------------------------------
diff --git a/python/pyspark/mllib/tests.py b/python/pyspark/mllib/tests.py
index dd3b66c..47dad7d 100644
--- a/python/pyspark/mllib/tests.py
+++ b/python/pyspark/mllib/tests.py
@@ -357,6 +357,12 @@ class StatTests(PySparkTestCase):
         summary = Statistics.colStats(data)
         self.assertEqual(10, summary.count())
 
+    def test_col_norms(self):
+        data = RandomRDDs.normalVectorRDD(self.sc, 1000, 10, 10)
+        summary = Statistics.colStats(data)
+        self.assertEqual(10, len(summary.normL1()))
+        self.assertEqual(10, len(summary.normL2()))
+
 
 class VectorUDTTests(PySparkTestCase):
 


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

Reply via email to