Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions python/pyspark/mllib/stat/_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ def max(self):
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):

Expand Down
6 changes: 6 additions & 0 deletions python/pyspark/mllib/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,12 @@ def test_col_with_different_rdds(self):
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):

Expand Down