[GitHub] spark pull request: [SPARK-5419][Mllib] Fix the logic in Vectors.s...
Github user asfgit closed the pull request at: https://github.com/apache/spark/pull/4217 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-5419][Mllib] Fix the logic in Vectors.s...
Github user mengxr commented on the pull request: https://github.com/apache/spark/pull/4217#issuecomment-71615458 Merged into master. Thanks! --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-5419][Mllib] Fix the logic in Vectors.s...
Github user AmplabJenkins commented on the pull request: https://github.com/apache/spark/pull/4217#issuecomment-71604007 Test PASSed. Refer to this link for build results (access rights to CI server needed): https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/26147/ Test PASSed. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-5419][Mllib] Fix the logic in Vectors.s...
Github user SparkQA commented on the pull request: https://github.com/apache/spark/pull/4217#issuecomment-71604002 [Test build #26147 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/26147/consoleFull) for PR 4217 at commit [`e8b0b3d`](https://github.com/apache/spark/commit/e8b0b3d18eeea7734148e40d5ad9d5af8e4d05bd). * This patch **passes all tests**. * This patch merges cleanly. * This patch adds no public classes. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-5419][Mllib] Fix the logic in Vectors.s...
Github user mengxr commented on the pull request: https://github.com/apache/spark/pull/4217#issuecomment-71603219 LGTM pending Jenkins. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-5419][Mllib] Fix the logic in Vectors.s...
Github user SparkQA commented on the pull request: https://github.com/apache/spark/pull/4217#issuecomment-71597558 [Test build #26147 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/26147/consoleFull) for PR 4217 at commit [`e8b0b3d`](https://github.com/apache/spark/commit/e8b0b3d18eeea7734148e40d5ad9d5af8e4d05bd). * This patch merges cleanly. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-5419][Mllib] Fix the logic in Vectors.s...
Github user viirya commented on the pull request: https://github.com/apache/spark/pull/4217#issuecomment-71597388 New commit is added for the comments. Thanks. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-5419][Mllib] Fix the logic in Vectors.s...
Github user AmplabJenkins commented on the pull request: https://github.com/apache/spark/pull/4217#issuecomment-71586983 Test PASSed. Refer to this link for build results (access rights to CI server needed): https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/26139/ Test PASSed. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-5419][Mllib] Fix the logic in Vectors.s...
Github user SparkQA commented on the pull request: https://github.com/apache/spark/pull/4217#issuecomment-71586980 [Test build #26139 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/26139/consoleFull) for PR 4217 at commit [`314c424`](https://github.com/apache/spark/commit/314c424b5197a88cf14f6c81a839014b21479831). * This patch **passes all tests**. * This patch merges cleanly. * This patch adds no public classes. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-5419][Mllib] Fix the logic in Vectors.s...
Github user mengxr commented on a diff in the pull request: https://github.com/apache/spark/pull/4217#discussion_r23585795 --- Diff: mllib/src/main/scala/org/apache/spark/mllib/linalg/Vectors.scala --- @@ -371,17 +371,19 @@ object Vectors { squaredDistance += score * score } - case (v1: SparseVector, v2: DenseVector) if v1.indices.length / v1.size < 0.5 => + case (v1: SparseVector, v2: DenseVector) => squaredDistance = sqdist(v1, v2) - case (v1: DenseVector, v2: SparseVector) if v2.indices.length / v2.size < 0.5 => + case (v1: DenseVector, v2: SparseVector) => squaredDistance = sqdist(v2, v1) - // When a SparseVector is approximately dense, we treat it as a DenseVector case (v1, v2) => -squaredDistance = v1.toArray.zip(v2.toArray).foldLeft(0.0){ (distance, elems) => - val score = elems._1 - elems._2 - distance + score * score +var kv = 0 +val nnzv = v1.size +while (kv < nnzv) { + var score = v1(kv) - v2(kv) --- End diff -- `var` -> `val` --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-5419][Mllib] Fix the logic in Vectors.s...
Github user mengxr commented on a diff in the pull request: https://github.com/apache/spark/pull/4217#discussion_r23585794 --- Diff: mllib/src/main/scala/org/apache/spark/mllib/linalg/Vectors.scala --- @@ -371,17 +371,19 @@ object Vectors { squaredDistance += score * score } - case (v1: SparseVector, v2: DenseVector) if v1.indices.length / v1.size < 0.5 => + case (v1: SparseVector, v2: DenseVector) => squaredDistance = sqdist(v1, v2) - case (v1: DenseVector, v2: SparseVector) if v2.indices.length / v2.size < 0.5 => + case (v1: DenseVector, v2: SparseVector) => squaredDistance = sqdist(v2, v1) - // When a SparseVector is approximately dense, we treat it as a DenseVector case (v1, v2) => --- End diff -- I would recommend using ~~~ case (DenseVector(vv1), DenseVector(vv2)) => var i = 0 val sz = vv1.size while (i < sz) { ... } case _ => // throw exception ~~~ --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-5419][Mllib] Fix the logic in Vectors.s...
Github user SparkQA commented on the pull request: https://github.com/apache/spark/pull/4217#issuecomment-71582448 [Test build #26139 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/26139/consoleFull) for PR 4217 at commit [`314c424`](https://github.com/apache/spark/commit/314c424b5197a88cf14f6c81a839014b21479831). * This patch merges cleanly. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request: [SPARK-5419][Mllib] Fix the logic in Vectors.s...
GitHub user viirya opened a pull request: https://github.com/apache/spark/pull/4217 [SPARK-5419][Mllib] Fix the logic in Vectors.sqdist The current implementation in Vectors.sqdist is not efficient because of allocating temp arrays. There is also a bug in the code `v1.indices.length / v1.size < 0.5`. This pr fixes the bug and refactors sqdist without allocating new arrays. You can merge this pull request into a Git repository by running: $ git pull https://github.com/viirya/spark-1 fix_sqdist Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/4217.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #4217 commit 314c424b5197a88cf14f6c81a839014b21479831 Author: Liang-Chi Hsieh Date: 2015-01-27T02:51:51Z Fix sqdist bug. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org