A simple recommender system

Here is an item-to-item version in which the utility matrix is Boolean: A simple recommender system.

Recommender algorithm 1 is as follows. Given an input list of (i, j) pairs, representing purchases of items yj bought by users xi:

  1. Initialize the utility matrix (uij) with m rows and n columns, where m is the number of users and n is the number of items.
  2. For each pair (i, j) in the input list, set uij = 1.
  3. Initialize the similarity matrix (sjk) with n rows and n columns.
  4. For each j = 1…n and each k = 1…n, set sjk = s(u, v), the cosine similarity of the jth column u and the kth column v of the utility matrix.
  5. For a given user-purchase pair (i, j) (that ...

Get Java Data Analysis now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.