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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to