326
CHAPTER 9. RECOMMENDATION SYSTEMS
Two Kinds of Document Similarity
Recall that in Section 3.4 we gave a method for ﬁnding documents that
were “similar,” using shingling, minhashing, and LSH. There, the notion
of similarity was lexical – documents are similar if they contain large,
identical sequences of characters. For recommendation systems, the notion
of similarity is diﬀerent. We are interested only in the occurrences of many
important words in both documents, even if there is little lexical similarity
between the documents.
However, the methodology for ﬁnding similar
documents remains almost the same. Once we have a distance measure,
either Jaccard or cosine, we can use minhashing (for Jaccard) or random
hyperplanes (for cosine distance; see Section 3.7.2) feeding data to an LSH
algorithm to ﬁnd the pairs of documents that are similar in the sense of
sharing many common keywords.
both, and 0’s do not impact the value of the dot product. To be precise, the dot
product is the size of the intersection of the two sets of words, and the lengths
of the vectors are the square roots of the numbers of words in each set. That
calculation lets us compute the cosine of the angle between the vectors as the
dot product divided by the product of the vector lengths.
9.2.3
Obtaining Item Features From Tags
Let us consider a database of images as an example of a way that features have
been obtained for items. The problem with images is that their data, typically
an array of pixels, does not tell us anything useful about their features. We can
calculate simple properties of pixels, such as the average amount of red in the
picture, but few users are looking for red pictures or especially like red pictures.
There have been a number of attempts to obtain information about features
of items by inviting users to tag the items by entering words or phrases that
describe the item. Thus, one picture with a lot of red might be tagged “Tianan-
men Square,” while another is tagged “sunset at Malibu.” The distinction is
not something that could be discovered by existing image-analysis programs.
Almost any kind of data can have its features described by tags. One of
the earliest attempts to tag massive amounts of data was the site del.icio.us,
later bought by Yahoo!, which invited users to tag Web pages. The goal of this
tagging was to make a new method of search available, where users entered a
set of tags as their search query, and the system retrieved the Web pages that
had been tagged that way. However, it is also possible to use the tags as a
recommendation system. If it is observed that a user retrieves or bookmarks
many pages with a certain set of tags, then we can recommend other pages with
the same tags.
The problem with tagging as an approach to feature discovery is that the
