Return-Path: X-Original-To: apmail-spark-commits-archive@minotaur.apache.org Delivered-To: apmail-spark-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EEF2318079 for ; Tue, 5 Jan 2016 23:33:32 +0000 (UTC) Received: (qmail 77131 invoked by uid 500); 5 Jan 2016 23:33:32 -0000 Delivered-To: apmail-spark-commits-archive@spark.apache.org Received: (qmail 77098 invoked by uid 500); 5 Jan 2016 23:33:32 -0000 Mailing-List: contact commits-help@spark.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@spark.apache.org Received: (qmail 77088 invoked by uid 99); 5 Jan 2016 23:33:32 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Jan 2016 23:33:32 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 84014E0441; Tue, 5 Jan 2016 23:33:32 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jkbradley@apache.org To: commits@spark.apache.org Message-Id: <32d03685bf964ad0b9451a0525465d7b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: spark git commit: [SPARK-12041][ML][PYSPARK] Add columnSimilarities to IndexedRowMatrix Date: Tue, 5 Jan 2016 23:33:32 +0000 (UTC) Repository: spark Updated Branches: refs/heads/master ff8997554 -> 1537e5560 [SPARK-12041][ML][PYSPARK] Add columnSimilarities to IndexedRowMatrix Add `columnSimilarities` to IndexedRowMatrix for PySpark spark.mllib.linalg. Author: Kai Jiang Closes #10158 from vectorijk/spark-12041. Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/1537e556 Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/1537e556 Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/1537e556 Branch: refs/heads/master Commit: 1537e55604cafafa49a8b7f3ce915f9745392bc0 Parents: ff89975 Author: Kai Jiang Authored: Tue Jan 5 15:33:27 2016 -0800 Committer: Joseph K. Bradley Committed: Tue Jan 5 15:33:27 2016 -0800 ---------------------------------------------------------------------- python/pyspark/mllib/linalg/distributed.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/1537e556/python/pyspark/mllib/linalg/distributed.py ---------------------------------------------------------------------- diff --git a/python/pyspark/mllib/linalg/distributed.py b/python/pyspark/mllib/linalg/distributed.py index 0e76050..e1f0221 100644 --- a/python/pyspark/mllib/linalg/distributed.py +++ b/python/pyspark/mllib/linalg/distributed.py @@ -297,6 +297,20 @@ class IndexedRowMatrix(DistributedMatrix): """ return self._java_matrix_wrapper.call("numCols") + def columnSimilarities(self): + """ + Compute all cosine similarities between columns. + + >>> rows = sc.parallelize([IndexedRow(0, [1, 2, 3]), + ... IndexedRow(6, [4, 5, 6])]) + >>> mat = IndexedRowMatrix(rows) + >>> cs = mat.columnSimilarities() + >>> print(cs.numCols()) + 3 + """ + java_coordinate_matrix = self._java_matrix_wrapper.call("columnSimilarities") + return CoordinateMatrix(java_coordinate_matrix) + def toRowMatrix(self): """ Convert this matrix to a RowMatrix. --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org For additional commands, e-mail: commits-help@spark.apache.org