# spark MLLIB alternating least squares recommendation

How do we use spark MLLIB ALS (alternating least squares) to recommend products to users? Basically we need to give ratings to products which are not rated by user. Example given is with ratings what if rating is "NA"- "not applicable"?

• I'm not sure about what do you mean by not applicable. Would you care explaining your use case ? I think that I might be able to help you with more information. – eliasah Jul 2 '16 at 11:55

Matrix factorization methods for recommender systems decompose large user-item matrix into lower dimensional user factors $p_u$ and item factors $q_i$. You can estimate the user rating by taking the inner product $r_{ui} = p_u^{T}q_i$. So if you have NaNs present in your rating data you can fill the NaNs with zeros.