Github user debasish83 commented on the pull request:

    https://github.com/apache/spark/pull/5005#issuecomment-81888798
  
    @mengxr agreed let's focus on NNLS in this PR since all the learning will 
be applicable to QuadraticMinimizer as well for which I can open up a separate 
PR. I will clean up accordingly.
    
    The iterator pattern is used in all breeze optimizers. In place of using 
while loops in inner optimization iterations, in Breeze we use iterator so that 
users can have control over the whole optimization path and not only in the end 
result....It has an overhead as shown below but it gives more control to user 
and I doubt @dlwh will agree to replace the iterator with while loop :-)
    
    Breeze NNLS
    
    Outer solveTime (includes Iterator overhead):
    
    15/03/16 12:26:42 INFO ALS: solveTime 149.791 ms
    15/03/16 12:26:42 INFO ALS: solveTime 148.574 ms
    15/03/16 12:26:43 INFO ALS: solveTime 51.775 ms
    15/03/16 12:26:43 INFO ALS: solveTime 53.457 ms
    15/03/16 12:26:43 INFO ALS: solveTime 21.818 ms
    15/03/16 12:26:43 INFO ALS: solveTime 21.524 ms
    15/03/16 12:26:43 INFO ALS: solveTime 36.549 ms
    15/03/16 12:26:43 INFO ALS: solveTime 37.247 ms
    15/03/16 12:26:44 INFO ALS: solveTime 22.049 ms
    15/03/16 12:26:44 INFO ALS: solveTime 21.902 ms
    
    Inner solveTime:
    
    15/03/16 12:26:42 INFO ALS: innerTime 70.256 ms
    15/03/16 12:26:42 INFO ALS: innerTime 68.018 ms
    15/03/16 12:26:43 INFO ALS: innerTime 26.507 ms
    15/03/16 12:26:43 INFO ALS: innerTime 27.55 ms
    15/03/16 12:26:43 INFO ALS: innerTime 17.481 ms
    15/03/16 12:26:43 INFO ALS: innerTime 17.298 ms
    15/03/16 12:26:43 INFO ALS: innerTime 30.942 ms
    15/03/16 12:26:43 INFO ALS: innerTime 31.361 ms
    15/03/16 12:26:44 INFO ALS: innerTime 17.723 ms
    15/03/16 12:26:44 INFO ALS: innerTime 17.395 ms
    
    mllib NNLS:
    
    15/03/16 12:28:03 INFO ALS: solveTime 39.141 ms
    15/03/16 12:28:03 INFO ALS: solveTime 43.465 ms
    15/03/16 12:28:04 INFO ALS: solveTime 19.215 ms
    15/03/16 12:28:04 INFO ALS: solveTime 20.26 ms
    15/03/16 12:28:04 INFO ALS: solveTime 5.776 ms
    15/03/16 12:28:04 INFO ALS: solveTime 5.601 ms
    15/03/16 12:28:04 INFO ALS: solveTime 9.33 ms
    15/03/16 12:28:04 INFO ALS: solveTime 10.247 ms
    15/03/16 12:28:05 INFO ALS: solveTime 6.951 ms
    15/03/16 12:28:05 INFO ALS: solveTime 7.373 ms
    
    So Breeze NNLS is still 2X slower.
    
    I had to use f2jBLAS for level 1 BLAS and level 2 BLAS for dgemv to bring 
the runtime within 2X.
    
    Some more optimizations that I can do is replace cforRange to while but we 
thought cforRange is faster ! Also in place of access a vector v through v(i), 
access it using v.data(i)...
    
    I checked in the version of the code in 
breeze.optimize.linear.NNLS...Please take a look if you can find any other 
issues...



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to