Algorithms

Video Selection

Each page in the app displays a selection of videos from the registered playlist according to different criteria.

Home Page

The aim of the home page is to show user videos that they like and will learn from, including those that they might not come into contact with if they just choose based on options generated from previous viewing.

The home page video selection will be generated using a set of criteria, both based on information about the user, and events happening in the wider world.

Type Source Notes and examples
Events Calendar within app database Olympics/Paralympics, World Cup, rocket launches,
Festivals Calendar within app database Christmas, Easter, Diwali, Passover
Weather Weather API Python modules such as MetOffer or Darkskies
The user’s location obtained from their IP address
Season Location from IP address
Calendar within app database
Popular Keen.io API Videos within the user’s playlist that are popular among all users of the app
Random Random Python library


I am displaying a grid of 12 video thumbnails on the home page. So with six types of criteria I will generate a list including two of each, and if nothing is available fitting those criteria more random videos will be added.

To test whether this is useful, I will set up an A/B test where users are randomly shown this homepage, or a totally random home page.

Recently Viewed

The Keen.io web analytics API allows developers to add “events” to their app that are registered on the platform whenever a user performs a particular action.

I first added an event which records whenever a user views a particular video.

keen.add_event("video_view", { "_id": user, "page": video, "referrer": url, "ip": ip })

Then I created a Route within Flask to generate a page of recently viewed videos, and used the Keen API to create a List of videos viewed over the last seven days.

recent_videolist = keen.select_unique("video_view", target_property="page", timeframe="this_7_days")

Popular

This page will show the videos viewed most often on the device, as recorded by the Keen API.

New

This page simply shows the latest videos added to the database from the playlist associated with the device.

Search

I am aiming for search results to be used to generate a playlist of videos based on the search terms, for example a search generates ten results, the user picks one of them, then the other nine results are shown underneath the video, and if autoplay is used the next in the list will play.

Recommendations from a video

The problem with recommendations based on the metadata of previous video (or whatever content you are working with) is the tendency for the subject to drift away from what the user was initially interested in.

They might choose or search for a video about farm equipment and get something relevant, then be recommended a cartoon including a tractor, then be recommended a cartoon from the same show.

Each time the app would have recommended a video based on the meta keywords of the original video but it YouTube Kids presumably shows a bias towards children’s videos when surfacing content. This is a good idea if videos are pulled from a general database and algorithmically filtered for suitability, but in my app, videos will be preselected so it isn’t as much of a consideration and I am free to use a system that aims to satisfy curiosity.

Using a method similar to the search results, each when selected video will generate a playlist of further videos based on the metadata of the initial video. Only when the user has watched all of those or follows a different navigation path will a different selection of videos load up.

Next Steps

  • To gather (from YouTube) or add (using video classification techniques) metadata describing each video to the database in order to power related videos and search results.  
Standard