You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Collaborative Filtering and Alternating Least Squares #139
ALS has a couple embarrassingly parallel stages. But getting good performance in a distributed setting requires some very careful bookkeeping about which blocks of the user and item factor matrices are required at each step. master...TomAugspurger:als does none of this bookkeeping at the moment, and is extremely slow.
I wonder if converting a naive numpy implementation to dask.array would work well
I'm not sure if this was intentional, but in general you should avoid the use of inv. The scipy.linalg.solve function is almost always more efficient and numerically stable. In your case I suspect that the matrix to be solved is also positive definite, in which case the posdef=True keyword should be used for an additional ~2x speed increase.
does none of this bookkeeping at the moment, and is extremely slow.
I may have been a bit hasty with this assessment. I didn't carefully check the blocked version I wrote.
I wonder if converting a naive numpy implementation to dask.array would work well
I think I wrote something that did that (will search for the notebook) and things seemed OK on a toy dataset. I haven't gotten a good grasp for how important sparsity is for this kind of problem.
I wonder if converting a naive numpy implementation to dask.array would work well
From the implicit readme,
this library is about 1.8 times faster than the multithreaded C++ implementation provided by Quora's QMF Library and at least 60,000 times faster than implicit-mf.
the latter is a numpy / scipy implementation of the original paper (though I imagine it can be optimized further)....
Also looking at the implicit vs spark comparison I imagine it will be difficult to match or outperform implicit ALS with dask-ml on a single multi-core machine since it's hand optimized in Cython and parallized with OpenMP already. So is the aim more the distributed case?
Activity
mrocklin commentedon Feb 20, 2018
Two comments:
inv. Thescipy.linalg.solvefunction is almost always more efficient and numerically stable. In your case I suspect that the matrix to be solved is also positive definite, in which case theposdef=Truekeyword should be used for an additional ~2x speed increase.mrocklin commentedon Feb 20, 2018
Also, here is an approach for a multi-dimensional ALS implementation based on dask array: https://gist.github.com/mrocklin/6fc759ab829a44c4f1969a6d6fc9dd28
mrocklin commentedon Feb 20, 2018
Also cc @jcrist who may be thinking about these sorts of problems in the near future.
TomAugspurger commentedon Feb 20, 2018
I may have been a bit hasty with this assessment. I didn't carefully check the blocked version I wrote.
I think I wrote something that did that (will search for the notebook) and things seemed OK on a toy dataset. I haven't gotten a good grasp for how important sparsity is for this kind of problem.
👍 https://www.johndcook.com/blog/2010/01/19/dont-invert-that-matrix/ I was being lazy.
mrocklin commentedon Feb 20, 2018
We can also handle sparsity through improved support for sparse sub-arrays in dask array.
rth commentedon Feb 20, 2018
From the implicit readme,
the latter is a numpy / scipy implementation of the original paper (though I imagine it can be optimized further)....
Also looking at the implicit vs spark comparison I imagine it will be difficult to match or outperform
implicitALS with dask-ml on a single multi-core machine since it's hand optimized in Cython and parallized with OpenMP already. So is the aim more the distributed case?