We have information about what the user likes in our app and we want to recommend content to similar users even those who may not have explicitly like a particular content but are similar to those who have explicitly liked that content.

I was planning to use the implicit feedback variation of Alternating Least Squares using Apache Spark to implement a recommender system which will find me the additional users that I can target.

One of the tuning parameters is a boolean flag nonnegative for non-negative matrix factorization.

I will be counting the number of likes per user and tag so I won't have negative values. Can I say nonnegative=true or does it mean something completely different. My understanding is that the nonnegative constraint is for the values inside the two matrices which the algorithm will decompose my original matrix to, but I don't have the knowledge to know if those values will be non-negative for my scenario.

Ref: Spark ALS Algorithm. Not exactly since there is another API but good enough for this question.

  • $\begingroup$ Is there an example that uses the Spark MlLib for NMF? $\endgroup$ – mgokhanbakal Dec 8 '17 at 14:43

Yes, the parameter nonnegative is for constraining values for both matrices: user features and item features to not have values below zeros while optimizing using ALS algorithm. It drive which solver to use: CholeskySolver or NNLS(conjugated gradient). Both are implemented in Spark mllib.

The flag is of course connected with the input. If You have ratings below zeros and You directly pump all of Your data to model, the prediction of negatives values while You have nonnegative constrain check will be somehow hard :-)

In Your case, what's important is that You have implicit feedback. So, You should set appropriate flag or use trainImplicit method. The easiest way to find out what works for Your case best with the nonnegative flag is to threat it as another hyper-parameter which needs cross-validation check. And for me, the measurement of the model while validating is a more crucial aspect. If You are trying to do top-N recommendations, go for ranking measures like Recall@N, MRR@N or AUC.

  • 1
    $\begingroup$ Thank you for your answer. It struck me too that I could use it as another hyper-parameter. However, this question is to understand the concept of nonnegativity i.e. if I can determine nonnegativity directly from my application input data i.e. implicit Ratings. $\endgroup$ – RAbraham Dec 13 '15 at 23:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.