How Does YouTube Suggest Videos toYou?

Eldrich Doyogan
Aug 4 · 4 min read

Have you seen the video below on your YouTube recommended list?

@kheslime / Twitter

A few days ago an instagram account I follow posted a meme about a video which showed up on my YouTube feed not too long ago. It is about a teen who had purportedly feigned mental illness in order to be deemed unfit for trial. As you might be able to tell, the premise of the channel’s videos are dubious at best. However, it made me want to investigate a little further, and find details regarding something we all seem to know; how and why does YouTube recommend us videos?


The second question is easier to address. Simply put, by recommending us videos the media company is able to keep our attention longer. By keeping us entertained for a longer period of time channels (and subsequently YouTube) are able to maximize the amount of money they earn from promotions, advertisements and premium content. YouTube has even released videos for its content creators to optimize their videos and descriptions, so that they may improve traffic towards their channels.

So how does YouTube know what to recommend its viewers? Through an algorithm. Unsurprisingly, the most ubiquitous concept of the 21st century allows the company to supply its patrons with content to entice them to stay watching.


The algorithm works as a feedback loop. The more videos a viewer watches, the more said algorithm is able to predict what other types of related content to recommend. The engine behind this a machine learning model which filters content several times before only a select few reach the viewer’s recommended list.

Structure of the filtering system YouTube uses.

A pattern like which channels attract the same viewers is closely monitored. Other details such as the thumbnail, description, title, likes, dislikes, and subscriptions are used as features on which machine learning models are trained.


The image below is a screenshot of a portion of my recommended list. Currently, the algorithm is recommending me two music related videos, a seafood cooking channel, an anime scene, a video game analysis, a travel vlog, and two prehistoric animals videos. It is the result of a machine learning model used by YouTube to predict the kinds of videos I should be interested in.

How exactly does this work? We covered that the algorithm recommends videos based on what it thinks the user would like to see. Which lead us to look at how it filters the videos based on users’ viewing histories. How then does it filter?

Nearest Neighbor

The machine learning model YouTube uses works by determining the likelihood of a viewer liking a video based on other videos they have previously watched. Although the algorithm is complex, this is a simple way to begin to grasp what it’s doing.

k-Nearest Neighbor or kNN

The image above is a simplified illustration of nearest neighbors classification algorithm, similar to what YouTube uses. You can think of this classification as binary to make it even simpler. Is this viewer going to like this video or is the viewer not going to like this video? Neighbors in this sense can be thought of as previous viewing history, likes, dislikes, description, thumbnail, etc. Because the algorithm knows this history and is trained on this data, it can be described as having been ‘classified’. Now, what this classification does is to try and predict the likelihood of a viewer liking a video based on its neighbors. What similarities between thumbnails does the user lean towards? What video length does the viewer prefer? Which channels attract the same demographic? By using these neighbors, the machine learning algorithm YouTube employs can filter and determine which videos have the highest likelihood to be pressed and watched by the viewer.

Geek Culture

Proud to geek out. Follow to join our +1M monthly readers.