You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by etrain <gi...@git.apache.org> on 2014/05/08 03:18:53 UTC

[GitHub] spark pull request: Use numpy directly for matrix multiply.

GitHub user etrain opened a pull request:

    https://github.com/apache/spark/pull/687

    Use numpy directly for matrix multiply.

    Using matrix multiply to compute XtX and XtY yields a 5-20x speedup depending on problem size.
    
    For example - the following takes 19s locally after this change vs. 5m21s before the change. (16x speedup).
    bin/pyspark examples/src/main/python/als.py local[8] 1000 1000 50 10 10

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/etrain/spark-1 patch-1

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/687.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 #687
    
----
commit d1ab9b6ef020bc0983a72da8a9add9cfc2356a4c
Author: Evan Sparks <ev...@gmail.com>
Date:   2014-05-08T01:18:36Z

    Use numpy directly for matrix multiply.
    
    Using matrix multiply to compute XtX and XtY yields a 5-20x speedup depending on problem size.
    
    For example - the following takes 19s locally after this change vs. 5m21s before the change. (16x speedup).
    bin/pyspark examples/src/main/python/als.py local[8] 1000 1000 50 10 10

----


---
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.
---

[GitHub] spark pull request: Use numpy directly for matrix multiply.

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/687#issuecomment-42504227
  
     Merged build triggered. 


---
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.
---

[GitHub] spark pull request: Use numpy directly for matrix multiply.

Posted by mengxr <gi...@git.apache.org>.
Github user mengxr commented on the pull request:

    https://github.com/apache/spark/pull/687#issuecomment-42512204
  
    LGTM. 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.
---

[GitHub] spark pull request: Use numpy directly for matrix multiply.

Posted by mengxr <gi...@git.apache.org>.
Github user mengxr commented on a diff in the pull request:

    https://github.com/apache/spark/pull/687#discussion_r12414654
  
    --- Diff: examples/src/main/python/als.py ---
    @@ -36,13 +36,10 @@ def rmse(R, ms, us):
     def update(i, vec, mat, ratings):
         uu = mat.shape[0]
         ff = mat.shape[1]
    -    XtX = matrix(np.zeros((ff, ff)))
    -    Xty = np.zeros((ff, 1))
    -
    -    for j in range(uu):
    -        v = mat[j, :]
    -        XtX += v.T * v
    -        Xty += v.T * ratings[i, j]
    +    
    +    XtX = mat.T * mat
    +    XtY = mat.T * ratings[i, :].T
    +    
         XtX += np.eye(ff, ff) * LAMBDA * uu
    --- End diff --
    
    @etrain Could you also update this line? We should only touch the diagonals.


---
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.
---

[GitHub] spark pull request: Use numpy directly for matrix multiply.

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/687#issuecomment-42504235
  
    Merged build started. 


---
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.
---

[GitHub] spark pull request: Use numpy directly for matrix multiply.

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/687#issuecomment-42513366
  
    Merged build finished. All automated tests 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.
---

[GitHub] spark pull request: Use numpy directly for matrix multiply.

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/687#issuecomment-42511994
  
     Merged build triggered. 


---
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.
---

[GitHub] spark pull request: Use numpy directly for matrix multiply.

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/687#issuecomment-42513367
  
    All automated tests passed.
    Refer to this link for build results: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/14804/


---
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.
---

[GitHub] spark pull request: Use numpy directly for matrix multiply.

Posted by rxin <gi...@git.apache.org>.
Github user rxin commented on the pull request:

    https://github.com/apache/spark/pull/687#issuecomment-42512234
  
    Thanks. 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.
---

[GitHub] spark pull request: Use numpy directly for matrix multiply.

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/687


---
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.
---

[GitHub] spark pull request: Use numpy directly for matrix multiply.

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/687#issuecomment-42511999
  
    Merged build started. 


---
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.
---

[GitHub] spark pull request: Use numpy directly for matrix multiply.

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/687#issuecomment-42506286
  
    All automated tests passed.
    Refer to this link for build results: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/14798/


---
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.
---

[GitHub] spark pull request: Use numpy directly for matrix multiply.

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/687#issuecomment-42506285
  
    Merged build finished. All automated tests 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.
---