You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by bwahlgreen <gi...@git.apache.org> on 2016/09/29 11:26:30 UTC
[GitHub] spark pull request #15296: [SPARK-17721][MLlib][ML] Fix for multiplying tran...
GitHub user bwahlgreen opened a pull request:
https://github.com/apache/spark/pull/15296
[SPARK-17721][MLlib][ML] Fix for multiplying transposed SparseMatrix with SparseVector [WIP]
## What changes were proposed in this pull request?
* changes the implementation of gemv with transposed SparseMatrix and SparseVector both in mllib-local and mllib (identical)
* adds a test that was failing before this change, but succeeds with these changes.
The problem in the previous implementation was that it only increments `i`, that is enumerating the columns of a row in the SparseMatrix, when the row-index of the vector matches the column-index of the SparseMatrix. In cases where a particular row of the SparseMatrix has non-zero values at column-indices lower than corresponding non-zero row-indices of the SparseVector, the non-zero values of the SparseVector are enumerated without ever matching the column-index at index `i` and the remaining column-indices i+1,...,indEnd-1 are never attempted. The test cases in this PR illustrate this issue.
## How was this patch tested?
I have run the specific `gemv` tests in both mllib-local and mllib. I am currently still running `./dev/run-tests`.
## ___
As per instructions, I hereby state that this is my original work and that I license the work to the project (Apache Spark) under the project's open source license.
Mentioning @dbtsai, @viirya and @brkyvz whom I can see have worked/authored on these parts before.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/bwahlgreen/spark bugfix-spark-17721
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/15296.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 #15296
----
commit 276591c25418cb0766fa82853fa361d113b02e2c
Author: Bjarne Fruergaard <bw...@gmail.com>
Date: 2016-09-29T09:32:08Z
fix gemv
commit 60bc8a4c2d5fa5feb7bf8bf15b483c37a410b017
Author: Bjarne Fruergaard <bw...@gmail.com>
Date: 2016-09-29T09:32:35Z
additional tests for gemv
----
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #15296: [SPARK-17721][MLlib][ML] Fix for multiplying transposed ...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/15296
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/66126/
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #15296: [SPARK-17721][MLlib][ML] Fix for multiplying transposed ...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:
https://github.com/apache/spark/pull/15296
**[Test build #66126 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/66126/consoleFull)** for PR 15296 at commit [`cdc3642`](https://github.com/apache/spark/commit/cdc36422f6e73dbe239c9d7ed568bbb138fae266).
* 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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #15296: [SPARK-17721][MLlib][ML] Fix for multiplying transposed ...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/15296
Merged build finished. 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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #15296: [SPARK-17721][MLlib][ML] Fix for multiplying tran...
Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on a diff in the pull request:
https://github.com/apache/spark/pull/15296#discussion_r81299643
--- Diff: mllib-local/src/main/scala/org/apache/spark/ml/linalg/BLAS.scala ---
@@ -638,12 +638,16 @@ private[spark] object BLAS extends Serializable {
val indEnd = Arows(rowCounter + 1)
var sum = 0.0
var k = 0
- while (k < xNnz && i < indEnd) {
+ while (i < indEnd && k < xNnz) {
--- End diff --
nit: an unnecessary change?
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #15296: [SPARK-17721][MLlib][ML] Fix for multiplying tran...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/spark/pull/15296
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #15296: [SPARK-17721][MLlib][ML] Fix for multiplying transposed ...
Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on the issue:
https://github.com/apache/spark/pull/15296
@bwahlgreen Actually since mllib-local was not in 1.6 or 1.5, would you mind sending a backport PR against branch-1.6? Thank you!
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #15296: [SPARK-17721][MLlib][ML] Fix for multiplying transposed ...
Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on the issue:
https://github.com/apache/spark/pull/15296
LGTM
I'll merge this with master and plan to backport it to branches for 2.0, 1.6, and 1.5.
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #15296: [SPARK-17721][MLlib][ML] Fix for multiplying transposed ...
Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on the issue:
https://github.com/apache/spark/pull/15296
ok to test
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #15296: [SPARK-17721][MLlib][ML] Fix for multiplying transposed ...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/15296
Can one of the admins verify this patch?
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #15296: [SPARK-17721][MLlib][ML] Fix for multiplying transposed ...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:
https://github.com/apache/spark/pull/15296
**[Test build #66126 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/66126/consoleFull)** for PR 15296 at commit [`cdc3642`](https://github.com/apache/spark/commit/cdc36422f6e73dbe239c9d7ed568bbb138fae266).
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #15296: [SPARK-17721][MLlib][ML] Fix for multiplying tran...
Posted by bwahlgreen <gi...@git.apache.org>.
Github user bwahlgreen commented on a diff in the pull request:
https://github.com/apache/spark/pull/15296#discussion_r81126367
--- Diff: mllib-local/src/main/scala/org/apache/spark/ml/linalg/BLAS.scala ---
@@ -638,12 +638,18 @@ private[spark] object BLAS extends Serializable {
val indEnd = Arows(rowCounter + 1)
var sum = 0.0
var k = 0
- while (k < xNnz && i < indEnd) {
+ while (i < indEnd && k < xNnz) {
if (xIndices(k) == Acols(i)) {
sum += Avals(i) * xValues(k)
+ k += 1
+ i += 1
+ }
+ else if (xIndices(k) < Acols(i)) {
--- End diff --
check
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #15296: [SPARK-17721][MLlib][ML] Fix for multiplying tran...
Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/15296#discussion_r81124910
--- Diff: mllib-local/src/main/scala/org/apache/spark/ml/linalg/BLAS.scala ---
@@ -638,12 +638,18 @@ private[spark] object BLAS extends Serializable {
val indEnd = Arows(rowCounter + 1)
var sum = 0.0
var k = 0
- while (k < xNnz && i < indEnd) {
+ while (i < indEnd && k < xNnz) {
if (xIndices(k) == Acols(i)) {
sum += Avals(i) * xValues(k)
+ k += 1
+ i += 1
+ }
+ else if (xIndices(k) < Acols(i)) {
--- End diff --
I think that would be ideal if it's not already covered, just to be sure. It ought to be a straightforward modification of a bit of test code you just added.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #15296: [SPARK-17721][MLlib][ML] Fix for multiplying transposed ...
Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:
https://github.com/apache/spark/pull/15296
LGTM although it was merged.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #15296: [SPARK-17721][MLlib][ML] Fix for multiplying tran...
Posted by bwahlgreen <gi...@git.apache.org>.
Github user bwahlgreen commented on a diff in the pull request:
https://github.com/apache/spark/pull/15296#discussion_r81124169
--- Diff: mllib-local/src/main/scala/org/apache/spark/ml/linalg/BLAS.scala ---
@@ -638,12 +638,18 @@ private[spark] object BLAS extends Serializable {
val indEnd = Arows(rowCounter + 1)
var sum = 0.0
var k = 0
- while (k < xNnz && i < indEnd) {
+ while (i < indEnd && k < xNnz) {
if (xIndices(k) == Acols(i)) {
sum += Avals(i) * xValues(k)
+ k += 1
+ i += 1
+ }
+ else if (xIndices(k) < Acols(i)) {
--- End diff --
elses on previous line, done. I must admit I haven't gone through the non-transpose case in as much detail, but that does not seem affected by this bug. Should I perhaps add a test that shows the non-transpose case is/remains unaffected?
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #15296: [SPARK-17721][MLlib][ML] Fix for multiplying tran...
Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/15296#discussion_r81123437
--- Diff: mllib-local/src/main/scala/org/apache/spark/ml/linalg/BLAS.scala ---
@@ -638,12 +638,18 @@ private[spark] object BLAS extends Serializable {
val indEnd = Arows(rowCounter + 1)
var sum = 0.0
var k = 0
- while (k < xNnz && i < indEnd) {
+ while (i < indEnd && k < xNnz) {
if (xIndices(k) == Acols(i)) {
sum += Avals(i) * xValues(k)
+ k += 1
+ i += 1
+ }
+ else if (xIndices(k) < Acols(i)) {
--- End diff --
Nit: pull the elses up onto the previous line. Does this affect the non-transposed case below too? I believe your change is indeed correct and the tests demonstrate that.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org