9.1 Recommender System  | Making recommendations -- [Machine Learning| Andrew Ng]
 Welcome to this second to last week of the machine learning specialization. I'm really happy that together we're almost all the way to the finish line. What we'll do this week is discuss recommender systems. This is one of the topics that has received quite a bit of attention in academia, but the commercial impact and the actual number of practical use cases of recommender systems seems to me to be even vastly greater than the amount of attention it has received in academia. Every time you go to an online shopping website like Amazon or a movie streaming sites like Netflix or go to one of the apps or sites that do food delivery, many of these sites will recommend things to you that they think you may want to buy or movies they think you may want to watch or restaurants that they think you may want to try out. And for many companies, a large fraction of sales is driven by their recommender systems. So today for many companies, the economics or the value driven by recommender systems is very large. And so what we're doing this week is take a look at how they work. So with that, let's dive in and take a look at what is a recommender system. I'm going to use as a running example, the application of predicting movie ratings. So say you run a large movie streaming website and your users have rated movies using one to five stars. And so in a typical recommender system, you have a set of users here. We have four users, Alice, Bob, Carol and Dave, which I've numbered users one through four as well as a set of movies, Love at Last, Romance Forever, Keep Up, Piece of Love, and then Non-Stop Car Chases and Smalls vs Karate. And what the users have done is rated these movies one to five stars. Or in fact, to make some of these examples a little bit easier, I'm just going to let them rate the movies from zero to five stars. So say Alice is rated Love at Last five stars, Romance Forever five stars. Maybe she has not yet watched Keep Puppies of Love, so you don't have a rating for that. And I'm going to denote that by a question mark. And she thinks Non-Stop Car Chases and Smalls vs Karate deserve zero stars. Bob rates that five stars, has not watched that, so you don't have a rating. Rates that four stars, zero, zero. Carol, on the other hand, thinks that deserves zero stars, has not watched that, zero stars. And she loves Non-Stop Car Chases and Smalls vs Karate. And Dave rates the movies as follows. In the typical recommender system, you will have some number of users, as well as some number of items, in this case, the items and movies that you want to recommend to the users. And even though I'm using movies in this example, the same logic or the same framework works for recommending anything from products or website myself, to restaurants, to even which media articles or social media articles to show to a user that may be more interesting for them. The notation I'm going to use is, I'm going to use NU to denote the number of users. So in this example, NU is equal to four because you have four users. And NM to denote the number of movies or really the number of items. So in this example, NM is equal to five because we have five movies. I'm going to set Rij to be equal to one if user j has rated movie i. So for example, user one, that is Alice, has rated movie one but has not rated movie three. And so R11 would be equal to one because she has rated movie one, but R31 would be equal to zero because she has not rated movie number three. Then finally, I'm going to use Yij to denote the rating given by user j to movie i. So for example, this rating here would be that movie three was rated by user two to be equal to four. Notice that not every user rates every movie and it's important for the system to know which users have rated which movies. That's why we're going to define Rij to be equal to one if user j has rated movie i and it will be equal to zero if user j has not rated movie i. So with this framework for recommender systems, one possible way to approach the problem is to look at the movies that users have not rated and to try to predict how users would rate those movies because then we can try to recommend to users things that they are more likely to rate as five stars. And in the next video, we'll start to develop an algorithm for doing exactly that, but making one very special assumption, which is we're going to assume temporarily that we have access to features or extra information about the movies, such as which movies are romance movies, which movies are action movies, and using that will start to develop an algorithm. But later this week, we'll actually come back and ask what if we don't have these features, how can we still get the algorithm to work then. But let's go on to the next video to start building up this algorithm.
[{"start": 0.0, "end": 6.8, "text": " Welcome to this second to last week of the machine learning specialization."}, {"start": 6.8, "end": 11.68, "text": " I'm really happy that together we're almost all the way to the finish line."}, {"start": 11.68, "end": 15.24, "text": " What we'll do this week is discuss recommender systems."}, {"start": 15.24, "end": 20.44, "text": " This is one of the topics that has received quite a bit of attention in academia, but"}, {"start": 20.44, "end": 25.28, "text": " the commercial impact and the actual number of practical use cases of recommender systems"}, {"start": 25.28, "end": 30.68, "text": " seems to me to be even vastly greater than the amount of attention it has received in"}, {"start": 30.68, "end": 32.52, "text": " academia."}, {"start": 32.52, "end": 38.44, "text": " Every time you go to an online shopping website like Amazon or a movie streaming sites like"}, {"start": 38.44, "end": 45.32, "text": " Netflix or go to one of the apps or sites that do food delivery, many of these sites"}, {"start": 45.32, "end": 49.84, "text": " will recommend things to you that they think you may want to buy or movies they think you"}, {"start": 49.84, "end": 53.92, "text": " may want to watch or restaurants that they think you may want to try out."}, {"start": 53.92, "end": 59.32, "text": " And for many companies, a large fraction of sales is driven by their recommender systems."}, {"start": 59.32, "end": 65.12, "text": " So today for many companies, the economics or the value driven by recommender systems"}, {"start": 65.12, "end": 67.22, "text": " is very large."}, {"start": 67.22, "end": 70.82, "text": " And so what we're doing this week is take a look at how they work."}, {"start": 70.82, "end": 75.0, "text": " So with that, let's dive in and take a look at what is a recommender system."}, {"start": 75.0, "end": 81.0, "text": " I'm going to use as a running example, the application of predicting movie ratings."}, {"start": 81.0, "end": 88.08, "text": " So say you run a large movie streaming website and your users have rated movies using one"}, {"start": 88.08, "end": 89.7, "text": " to five stars."}, {"start": 89.7, "end": 94.44, "text": " And so in a typical recommender system, you have a set of users here."}, {"start": 94.44, "end": 98.96000000000001, "text": " We have four users, Alice, Bob, Carol and Dave, which I've numbered users one through"}, {"start": 98.96000000000001, "end": 104.28, "text": " four as well as a set of movies, Love at Last, Romance Forever, Keep Up, Piece of Love, and"}, {"start": 104.28, "end": 108.48, "text": " then Non-Stop Car Chases and Smalls vs Karate."}, {"start": 108.48, "end": 113.28, "text": " And what the users have done is rated these movies one to five stars."}, {"start": 113.28, "end": 118.36, "text": " Or in fact, to make some of these examples a little bit easier, I'm just going to let"}, {"start": 118.36, "end": 121.64, "text": " them rate the movies from zero to five stars."}, {"start": 121.64, "end": 126.74000000000001, "text": " So say Alice is rated Love at Last five stars, Romance Forever five stars."}, {"start": 126.74000000000001, "end": 130.6, "text": " Maybe she has not yet watched Keep Puppies of Love, so you don't have a rating for that."}, {"start": 130.6, "end": 133.44, "text": " And I'm going to denote that by a question mark."}, {"start": 133.44, "end": 139.16, "text": " And she thinks Non-Stop Car Chases and Smalls vs Karate deserve zero stars."}, {"start": 139.16, "end": 144.07999999999998, "text": " Bob rates that five stars, has not watched that, so you don't have a rating."}, {"start": 144.07999999999998, "end": 146.96, "text": " Rates that four stars, zero, zero."}, {"start": 146.96, "end": 152.84, "text": " Carol, on the other hand, thinks that deserves zero stars, has not watched that, zero stars."}, {"start": 152.84, "end": 156.64, "text": " And she loves Non-Stop Car Chases and Smalls vs Karate."}, {"start": 156.64, "end": 160.88, "text": " And Dave rates the movies as follows."}, {"start": 160.88, "end": 168.0, "text": " In the typical recommender system, you will have some number of users, as well as some"}, {"start": 168.0, "end": 176.4, "text": " number of items, in this case, the items and movies that you want to recommend to the users."}, {"start": 176.4, "end": 181.34, "text": " And even though I'm using movies in this example, the same logic or the same framework works"}, {"start": 181.34, "end": 187.04, "text": " for recommending anything from products or website myself, to restaurants, to even which"}, {"start": 187.04, "end": 191.2, "text": " media articles or social media articles to show to a user that may be more interesting"}, {"start": 191.2, "end": 192.2, "text": " for them."}, {"start": 192.2, "end": 199.32, "text": " The notation I'm going to use is, I'm going to use NU to denote the number of users."}, {"start": 199.32, "end": 203.92, "text": " So in this example, NU is equal to four because you have four users."}, {"start": 203.92, "end": 208.92, "text": " And NM to denote the number of movies or really the number of items."}, {"start": 208.92, "end": 213.62, "text": " So in this example, NM is equal to five because we have five movies."}, {"start": 213.62, "end": 222.72, "text": " I'm going to set Rij to be equal to one if user j has rated movie i."}, {"start": 222.72, "end": 231.36, "text": " So for example, user one, that is Alice, has rated movie one but has not rated movie three."}, {"start": 231.36, "end": 240.56, "text": " And so R11 would be equal to one because she has rated movie one, but R31 would be equal"}, {"start": 240.56, "end": 244.56, "text": " to zero because she has not rated movie number three."}, {"start": 244.56, "end": 250.96, "text": " Then finally, I'm going to use Yij to denote the rating given by user j to movie i."}, {"start": 250.96, "end": 257.24, "text": " So for example, this rating here would be that movie three was rated by user two to"}, {"start": 257.24, "end": 259.56, "text": " be equal to four."}, {"start": 259.56, "end": 264.6, "text": " Notice that not every user rates every movie and it's important for the system to know"}, {"start": 264.6, "end": 267.28, "text": " which users have rated which movies."}, {"start": 267.28, "end": 273.96, "text": " That's why we're going to define Rij to be equal to one if user j has rated movie i and"}, {"start": 273.96, "end": 278.23999999999995, "text": " it will be equal to zero if user j has not rated movie i."}, {"start": 278.23999999999995, "end": 283.5, "text": " So with this framework for recommender systems, one possible way to approach the problem is"}, {"start": 283.5, "end": 289.4, "text": " to look at the movies that users have not rated and to try to predict how users would"}, {"start": 289.4, "end": 294.08, "text": " rate those movies because then we can try to recommend to users things that they are"}, {"start": 294.08, "end": 298.64, "text": " more likely to rate as five stars."}, {"start": 298.64, "end": 303.32, "text": " And in the next video, we'll start to develop an algorithm for doing exactly that, but making"}, {"start": 303.32, "end": 308.59999999999997, "text": " one very special assumption, which is we're going to assume temporarily that we have access"}, {"start": 308.59999999999997, "end": 314.96, "text": " to features or extra information about the movies, such as which movies are romance movies,"}, {"start": 314.96, "end": 320.34, "text": " which movies are action movies, and using that will start to develop an algorithm."}, {"start": 320.34, "end": 325.11999999999995, "text": " But later this week, we'll actually come back and ask what if we don't have these features,"}, {"start": 325.11999999999995, "end": 328.52, "text": " how can we still get the algorithm to work then."}, {"start": 328.52, "end": 351.24, "text": " But let's go on to the next video to start building up this algorithm."}]