Previous: Expenses & Costs - How to Spend Money Wisely: Crash Course Entrepreneurship #14
Next: Italian and German Unification: Crash Course European History #27



View count:84,348
Last sync:2024-04-14 18:15


Citation formatting is not guaranteed to be accurate.
MLA Full: "How YouTube knows what you should watch: Crash Course AI #15." YouTube, uploaded by CrashCourse, 22 November 2019,
MLA Inline: (CrashCourse, 2019)
APA Full: CrashCourse. (2019, November 22). How YouTube knows what you should watch: Crash Course AI #15 [Video]. YouTube.
APA Inline: (CrashCourse, 2019)
Chicago Full: CrashCourse, "How YouTube knows what you should watch: Crash Course AI #15.", November 22, 2019, YouTube, 10:52,
Subscribe to Sound Field!
Today we’re going to talk about recommender systems which form the backbone of so much of the content we see online from video recommendations on YouTube and Netflix to ads we see on Facebook, Twitter, and well, everywhere else. We’ll talk about their types of systems - content-based, social, and personalized recommendations - and take a closer look at what they're good at, but also why they often fail.

Crash Course is produced in association with PBS Digital Studios:

Crash Course is on Patreon! You can support us directly by signing up at

Thanks to the following patrons for their generous monthly contributions that help keep Crash Course free for everyone forever:

Eric Prestemon, Sam Buck, Mark Brouwer, Indika Siriwardena, Avi Yashchin, Timothy J Kwist, Brian Thomas Gossett, Haixiang N/A Liu, Jonathan Zbikowski, Siobhan Sabino, Zach Van Stanley, Jennifer Killen, Nathan Catchings, Brandon Westmoreland, dorsey, Kenneth F Penttinen, Trevin Beattie, Erika & Alexa Saur, Justin Zingsheim, Jessica Wode, Tom Trval, Jason Saslow, Nathan Taylor, Khaled El Shalakany, SR Foxley, Sam Ferguson, Yasenia Cruz, Eric Koslow, Tim Curwick, David Noe, Shawn Arnold, William McGraw, Andrei Krishkevich, Rachel Bright, Jirat, Ian Dundore

Want to find Crash Course elsewhere on the internet?
Facebook -
Twitter -
Tumblr -
Support Crash Course on Patreon:

CC Kids:

#CrashCourse #MachineLearning #ArtificialIntelligence

 (00:00) to (02:00)

Jabril: So, John Green-Bot, do you remember when you let me use your computer the other day?  Well, I went on YouTube, and it was like seeing a completely different website.  There were videos about restoring old VCRs and different kinda casette tapes and ads for motor oil?  

John Green-Bot: Yes, Jabril.  I love learning about other machines.  

J: Okay, but, do you even know what humans are watching these days?  What about those Boston (?~0:22) mix videos?

JGB: No.  The humans in those videos are so mean to the robots.  What about Epic Computational Battles of History or MKBAI or Robot Appetit?  

J: What?


J: Hi, I'm Jabril, and welcome to Crash Course:AI.  Recommender systems are a type of AI that try to understand our brains and make useful recommendations to us.  This kind of AI can guide the things we watch by recommending YouTube videos or shows on Netflix for example.  On Amazon, it's recommending items to buy.  When I search on Google, it's recommending relevant and interesting links, and everywhere online, advertisements servers are trying to recommend products and services.  

Recommender systems combine supervised learnign and unsupervised learning techniques to learn about us, and because we're so complicated, recommending stuff to us is a tough problem that can produce a lot of unexpected results.  Maybe we get caught in an online bubble and only see Tweets from our friends and people who think like us.  Maybe we miss a new TV show because streaming sites don't think we'd like it, or maybe that creepy thing happens where you're talking to your friends about supercomputers and then every single ad that you see after that is just about supercomputers.

AI that can make recommendations can really change what version of the internet we all see, but to understand the benefits and drawbacks of these algorithms, we have to understand where they get their data and how they work.  As an example, let's focus on an algorithm that can recommend YouTube videos, because the algorithm is a really big deal if YouTube is your job, and everyone's talking about the mysterious changes behind the algorithm anyway.

 (02:00) to (04:00)

Three common approaches are content-based recommendations, social recommendations, and personalized recommendations.  Content-based recommendations look at the content of the videos, not the audience.  Like, for example, our algorithm may decide to recommend more recent videos or videos that are made by someone on a list of quality creators, but this means someone has to decide who quality creators are or program an AI that tries to predict creator quality.

On the other hand, social recommendations pay attention to the audience.  YouTube is on the internet, so we can use social ratings such as likes or views or watch time to decide what people are watching and should be recommended, but not everyone likes the same stuff, so maybe pure popularity isn't the way to go.

Different people have different preferences, so our AI can incorporate that with personalized recommendations.  If you like this Crash Course video, maybe we'd recommend other Crash Course videos or videos from my channel, but the problem with personalized recommendations is that it might be difficult to stumble onto new, interesting stuff, so to get the best of all worlds, recommender systems generally use collaborate filtering, which combines all three of these recommenders.  

When we see a recommendation on YouTube, it could be because that video is similar to other videos that we've watched and liked and other people who have similar tastes watched and liked that video, or, especially if you're new to YouTube, that video might be recommended because it's popular and lots of people are watching and liking it.

Collaborate filtering combines several of the techniques we've already talked about in Crash Course AI.  It uses unsupervised learning to find similar people or content and it tries to use data from those things to predict how we'll feel about something we haven't even seen yet.  To see how collaborative filtering works, let's use a simple example.

In this table, YouTube channels are represented as columns, so here, one column represents Crash Course. 

 (04:00) to (06:00)

One is Jabrils.  One is The Best of Battlebots.  One is The Art Assignment, and so on.  Specific users that watch YouTube videos are represented as rows.  So this row is John Green-bot.  This one is me.  These two are a couple of random folks.  This one is our producer Brandon, and so on.  Each cell in the table corresponds to whether the users subscribe to a specific channel or not.  One means they're watched at least one video and subscribed.  0 means they've watched at least one video and didn't subscribe, and the cell is empty if they haven't seen any videos.  If we look at John Green-bot's row, he subscribes to Crash Course and Jabrils, so those cells have a 1.  He saw The Best of Battlebots and did not subscribe because of all of the robot-on-robot violence.  So that's a 0, and he's never seen The Art Assignment, so there's no information in that cell.

To recommend new channels for John Green-bot, our collaborative filtering AI needs to predict how likely he is to subscribe to a channel he's never seen before.  In this case, let's see if The Art Assignment ends up in his recommendations.  To make your prediction, the algorithm needs to look at which other users have subscribed to The Art Assignment, and because YouTube tastes are very personal, instead of looking at all other users, our algorithm will focus on finding users who are most similar to John Green-bot.  Finding similar things is a classic unsupervised learning problem.  Our AI can look at all the rows, cluster together similar users, and then pick some of those that are most similar to John Green-bot.  Let's just say there are 1000 of these specific users, but there are also other clusters with thousands of users that these recommender systems take into consideration.

Now, we have a classic supervised learning problem.  Training an AI to make predictions based on past examples.  In this case, we're training an AI to predict a 1 or a 0, subscribe or not for John Green-bot based on other users.  We can readjust the results so that the ratings from the cluster of 1000 most similar users are given more weight in the final prediction, compared to those other clusters and after the predictions are sorted, our AI does predict that John Green-bot would subscribe to The Art Assignment, so it gets recommended to him, along with some other new channels.

 (06:00) to (08:00)

Recommender systems that use collaborative filtering AI can take in lots of different data, not just a 1 or a 0 for whether a user subscribed to a YouTube channel or bought a product.  A movie rating site might use a 1-5 star rating system or a social media AI could keep track of the number of milliseconds a user dwells on a post.  Regardless, the basic strategy is the same: use known information from users to predict preferences and this can get complicated on big websites that gather lots of user information using a combination of different algorithms.  

The real world is full of a lot of data and there are three key problems that can lead to recommender systems making small or big mistakes.  First, datasets that recommender system AIs get are usually very sparse.  Most people don't watch most shows or videos--there just isn't enough time, and even fewer people give social ratings such as likes.  Doing any kind of anlaysis with sparse datasets is very computationally intense, which gets expensive, which means some companies are willing to lose accuracy to reduce cost.

Second, there's the cold start problem.  When we go on a website for the first time, for example, the AI doesn't know enough about us to provide good personalized recommendations.  And third, even if an AI makes statistically likely predictions, that doesn't mean those recommendations are actually useful to us.  Online ads run into this failure a lot, like we'll be shown ads for sites we've recently visited or for something we've just bought.  Sure, that's probably something I'm interested in, but I could have figured that out without a recommender system.

In a potentially more harmful way, recommender systems don't understand important social contexts, so statistically likely recommendations can be worrying.  Recommendations may stereotype users in a socially uncomfortable way, like an AI might assume that just because John Green-bot is a robot, he really wants to watch Wall-E and Robocop.  Just because he's a robot doesn't mean he wants to watch robot stuff, or recommendations might be inappropriate for certain users.

 (08:00) to (10:00)

Like recommending a video that a parent would consider too violent for their children after they watch a bunch of Nerf war videos, and on social media, recommendations can trap us in ideological echo chambers, where we tend to only see the opinions from people that agree with us, which can skew our knowledge about the world.

This idea that we all see slightly different versions of the internet and data is constantly being collected about us can be a little concerning, but understanding how recommender systems work can help us live more knowledgeable lives and co-exist with AI.  When we don't want data added to a recommender system's model of us, we can use a private or incognito browser window and not log into sites.  If we open a news home page this way, we might see what the average human or robot is being recommended.

Of course, incognito browsers don't mean total privacy, but the strategy prevents sites from connecting data, like my Twitter account with my searches for tiny polo shirts on Google, because I need to get John Green-bot a birthday present.  Plus, since we spend so much time online, we might want to make the most of it with really personalized recommendations, so seriously, like, comment, and subscribe to your favorite creators, because as we leave ratings, reviews, and other traces of online activities, recommender systems can learn better models.

Recommender systems are part of the internet as we know it whether we like it or not, and as AI becomes a bigger part of our lives, these kind of recommendations will be too, so it's on us to be aware of this technology so that we know what kind of world we're living in and the ways AI might influence us every single day, and if you're here to learn how to build recommender systems, my advice would be to think explicitly about the trade-offs that are involved.  Deciding how to define the clusters of users or items can create more or less personalized spaces.  In our next episode, we'll work together on some code to build a recommender system and we'll get some hands-on experience with weighing some of these trade-offs.  

 (10:00) to (10:52)

I'll see you then.

And speaking of recommendations, you should check out Sound Field.  Sound Field is a new music education show from PBS Digital Studios that explores the music theory, production, history, and culture behind our favorite songs and musical styles.  Hosted by two supremely talented musicians, Arthur LA Buckner and Nahre Sol, every episode is one part video essay and one part musical performance.  So go subscribe to Sound Field, link in the description below. 

Crash Course: AI is produced in association with PBS Digital Studios.  If you want to help keep Crash Course free for everyone forever, you can join our community on Patreon, and if you want to watch more Sound Field, check out the video below.