Section 1
Recommender systems
Many applications predict the association between a user and an item. The proxy might be a click on an ad, a rating, or a purchase. The book describes this as a regression or a probabilistic classification problem. Early methods used only the user ID and the item ID. They generalize by similarity: users who like the same items are assumed to share tastes, and that idea is called collaborative filtering.
How to use this pageClick any colored symbol in an equation or a sentence and it explains itself. Move the controls before you read the text under each demo.
embeddings and the demo items
predictions
biases and angles
indices
A simple parametric method is the bilinear prediction in equation (12.20). Each user and each item gets an embedding, and the prediction is their dot product, corrected by a bias for the user and a bias for the item. The book says the user bias captures how positive or grumpy a user is in general, and the item bias captures how popular the item is.
Click any coloured symbol to see what it means.
The book notes that the SVD and this bilinear model did very well in the Netflix competition. Missing entries are a problem for the SVD, because it treats them as zeros. Gradient descent on the observed ratings avoids that cost. Cold start remains a limit: a new user or item has no ratings, so content features are needed.
Predict firstA user has the taste angle 0 in the demo below. Item 1, item 2 and item 3 have embeddings (1, 0), (0, 1) and (0.7, 0.7). Which item gets the highest predicted rating, with the biases set to zero?
The taste of one user
The user’s embedding is a unit vector at the taste angle . The item embeddings are placed on the plane. The predicted rating is the dot product, with both biases set to zero. The item positions and the zero biases are added here.
Challenge +8 XPTurn the taste so that item 3 has the highest predicted rating.
The toy is the simplest case of equation (12.20). Real systems stack many embedding dimensions and add the biases back in, and the book says the bilinear form is often a component of state-of-the-art systems.
Section 2
Exploration versus exploitation
A recommender only sees the responses to the items it showed. The book calls this a contextual bandit problem: the learner takes one action for a context, such as a user, and sees only the reward for that action. It gets no information about the other items. Exploration tries an action to learn about it. Exploitation picks the action that the current policy rates highest. The book gives a warning: a learner that never explores can keep choosing a wrong item, because the right item never receives data.
Predict firstA learner always picks the item with the highest estimate, and it breaks ties by taking the lowest index. Its estimates start at zero. Will it ever try the best item?
Three items with unknown rewards
Each item gives a reward of 1 with a hidden probability: 0.2, 0.5 and 0.8. The learner sees only its own rewards. The probabilities are added here. Every run uses one fixed random seed, so the percentages below hold for that seed only. A different seed gives somewhat different shares.
Challenge +8 XPFind an exploration rate at which the best item is chosen in at least 90% of the last 100 rounds.
The book notes that supervised learning has no trade-off between exploration and exploitation, because the label always says which output is right. In the bandit, the choice of exploration rate decides whether the learner ever finds the best item, and the time scale decides how much exploration is worth.
Section 3
Knowledge bases and triplets
Knowledge bases store facts as triplets. A triplet has a subject, a verb and an object, as in equation (12.21), and the values are an entity, a relation and another entity, as in equation (12.22). An attribute takes one argument, as in equation (12.23). The book gives the example that a relation such as is_a_type_of contains the pair (dog, mammal).
Click any coloured symbol to see what it means.
The book also gives the example of an attribute has_fur applied to dog, written as equation (12.23).
Click any coloured symbol to see what it means.
The book suggests training an embedding for each entity and each relation, and a model of their joint distribution, with each triplet as a training example. That is the same logic that makes word embeddings work.
Predict firstThe knowledge base holds (dog, is_a_type_of, mammal). The book says a corrupted triple is built by replacing one entity. If you replace mammal with animal, what can you say about (dog, is_a_type_of, animal)?
Corrupting a true fact
The knowledge base lists three triplets, which are added here. Choose a replacement object for dog to see how the table and the world disagree. The truth values are added here and are not printed in the book.
(dog, is_a_type_of, mammal) (cat, is_a_type_of, mammal) (mammal, is_a_type_of, animal)
Challenge +8 XPPick the corruption that is true in the world but missing from the knowledge base.
The book says a model that scores such a corruption highly is not necessarily wrong. The table is incomplete, and most knowledge bases were built by manual labor, so many true relations are absent.
Section 4
Link prediction and question answering
Link prediction predicts missing arcs in the knowledge graph. It generalizes from old facts to new ones. Evaluation is hard, because the data contain only true facts. The book builds negatives by corruption, and it scores the model by how it ranks a held-out true fact among the corrupted versions. The popular precision at 10% metric counts how often the true fact lands in the top 10% of the candidates. The demo below uses 21 candidates, which makes the top 10% the top two (added here).
Predict firstA true fact ranks 12th among 21 candidates. Is it in the top 10%?
Where the true fact ranks
The dots show the scores of 20 corrupted facts, which are added here. Move the score of the true fact. The readout gives its rank among the 21 candidates.
Challenge +8 XPRaise the true fact until it is in the top 10%, so its rank is at most 2.
Question answering needs memory as well as reasoning. The book notes that memory networks were first proposed for a toy question answering task (Weston et al., 2014), and that an extension used GRU recurrent networks to read the input into memory (Kumar et al., 2015). A general question answering system remains an open problem, and the book says it can be solved only in restricted toy environments.
This section closes Part II of the book. Part III begins on page 486 and covers methods designed for less labeled data and a wider range of tasks.
- Recommenders predict user-item associations with embeddings, and the bilinear prediction in equation (12.20) is a simple and strong component.
- A learner that only sees the items it shows can stay on a poor item, so exploration is needed.
- Knowledge bases store triplets, and corrupted triplets may be true facts that the table lacks.
- Link prediction is scored by rank, and precision at 10% counts how often the true fact reaches the top 10%.
Final quizCheck yourself
Questions that mix the whole module. Each one is scored, and the score feeds your mastery of this module.
Source: Ian Goodfellow, Yoshua Bengio and Aaron Courville, Deep Learning, MIT Press, 2016, Section 12.5 (pages 478–485), free to read at deeplearningbook.org. Where the book prints equation numbers, the numbers here follow the book. The order of ideas follows the book. The explanations and all demos were written for this page.