I'm currently studying an item-based collaborative filtering algorithm described in Ul Haq, Raza - Hybrid Recommender System Towards User Satisfaction. I've formulated the algorithm below based on it. I have no problem on steps 1 to 3 but ...

  • in step 4 it says there: Set the threshold value n. How can I determine the value of n? Is there a formula for getting the value of it? I already checked it out but there's nothing there.
  • in Step 5: Select the K most similar products in M. The same question, how can I compute the value of K?
  1. Retrieve all the item rated by an active user and put it to Q.
  2. Isolate the users who have rated both the target item (i) and the items rated by the active user in Q, get the item and put it in R. (co-rated items)
  3. Calculate the item similarities using the Pearson Correlation Coefficient with all the items (j) in R.
  4. Set the threshold value n, If the similarity of i and j is greater or equal to n, (sim(i,j) >= n), Then include it in M.
  5. Select the K most similar products in M.
  6. Take the weighted average of the users rating on these similar items K.

1 Answer 1


K and n are so called hyperparameters (http://en.wikipedia.org/wiki/Hyperparameter_optimization). Although sometimes there is a rule of a thumb, an exhaustive rule would require to take all aspects of the data in the account, so in general one is better off to carefully optimize them via inner (cross-)validation.

cbeleites has described how to do so in an excellent answer to this question: Nested cross validation for model selection


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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