Trending

The Algorithm

Based on the aggregated watch history of all users, the algorithm finds currently most popular content. The assumption is that the more popular the content is, the more users will find it personally relevant. Moreover, public broadcasters produce a lot of content relevant to everyone independently of their tastes (such as news content).

Warning

Trending is an algorithm which provides non-personalised recommendations, i.e. all users get the same content recommended. Individual preferences are not taken into account.

Like collaborative filtering or diversified algorithm, trending does not use content metadata and computes recommendations based on user watch history only.

Note

This algorithm is commonly used as a fallback algorithm in case the main recommendation algorithm does not return any result for some reason. The PEACH website contains a tutorial explaining how to set up a fallback algorithm.

Prerequisites

To be able to successfully follow this tutorial, you need to be familiar with notebooks and the pipe Manager Interface. In case you are not, follow this tutorial first.

The Structure

The algorithm is divided into two notebooks: a task and a query notebook. The task notebook contains trending items computation as a function decorated with @pipe_task. This task is executed regularly to find the most currently popular items. The implementation considers an item current if it was watched at least once in the past week.

Summary

You will need to make some changes to adapt the algorithm for your event data source and event format.

The Workflow

1. Specify path to play events data

You will first need to specify data_path to your play events data in the pipe_task. Additionally, specify the codops and the algorithm name (algorithm). The later two fields are used in naming of Redis keys.

2. Modify event preprocessing function

Convert play events into the format specified in the parse_data() function.

3. Recommendation query

Now, go to the notebook which contains @pipe_query . Make sure that the Redis key where the trending items are saved to after the task computation is the same here.

Success

That's it! Now you can compute trending items by running the @pipe_task function from the first notebook and then request recommendations by calling the @pipe_query in the other notebook.

Final notes

If something is still unclear or you have any problem, please don't hesitate to contact us.

There is an example of the algorithm available in the notebooks under pipe_algorithms/notebooks/tutorials/trending.