9.2. CONTENT-BASED RECOMMENDATIONS
329
of the vectors representing the item proﬁles for the items in which the utility
matrix has 1 for that user.
Example 9.3 : Suppose items are movies, represented by Boolean proﬁles with
components corresponding to actors. Also, the utility matrix has a 1 if the user
has seen the movie and is blank otherwise. If 20% of the movies that user U
likes have Julia Roberts as one of the actors, then the user proﬁle for U will
have 0.2 in the component for Julia Roberts.
✷
If the utility matrix is not Boolean, e.g., ratings 1–5, then we can weight
the vectors representing the proﬁles of items by the utility value.
It makes
sense to normalize the utilities by subtracting the average value for a user.
That way, we get negative weights for items with a below-average rating, and
positive weights for items with above-average ratings. That eﬀect will prove
useful when we discuss in Section 9.2.6 how to ﬁnd items that a user should
like.
Example 9.4 : Consider the same movie information as in Example 9.3, but
now suppose the utility matrix has nonblank entries that are ratings in the 1–5
range. Suppose user U gives an average rating of 3. There are three movies
with Julia Roberts as an actor, and those movies got ratings of 3, 4, and 5.
Then in the user proﬁle of U, the component for Julia Roberts will have value
that is the average of 3 −3, 4 −3, and 5 −3, that is, a value of 1.
On the other hand, user V gives an average rating of 4, and has also rated
three movies with Julia Roberts (it doesn’t matter whether or not they are the
same three movies U rated). User V gives these three movies ratings of 2, 3,
and 5. The user proﬁle for V has, in the component for Julia Roberts, the
average of 2 −4, 3 −4, and 5 −4, that is, the value −2/3.
✷
9.2.6
Recommending Items to Users Based on Content
With proﬁle vectors for both users and items, we can estimate the degree to
which a user would prefer an item by computing the cosine distance between
the user’s and item’s vectors. As in Example 9.2, we may wish to scale var-
ious components whose values are not Boolean. The random-hyperplane and
locality-sensitive-hashing techniques can be used to place (just) item proﬁles
in buckets. In that way, given a user to whom we want to recommend some
items, we can apply the same two techniques – random hyperplanes and LSH –
to determine in which buckets we must look for items that might have a small
cosine distance from the user.
Example 9.5 : Consider ﬁrst the data of Example 9.3. The user’s proﬁle will
have components for actors proportional to the likelihood that the actor will
appear in a movie the user likes. Thus, the highest recommendations (lowest
cosine distance) belong to the movies with lots of actors that appear in many
