Machine learning
Streaming Recommendation System
The whole brief is open to read. This lab's datasets come with Premium.
- Company
Amazon Prime Video- Job positions
- Data ScientistML EngineerProduct Analyst
- Topics
- Recommender systemsCollaborative filteringRanking metricsCold startpandas
The scenario
Amazon Prime Video: Build a recommender that ranks ten titles per viewing profile, and beat showing everybody the most popular ones.
The top row of the Amazon Prime Video home screen has ten slots, and it decides what most people watch. Filling it with whatever is most popular works better than it sounds, so that is the bar to clear. Two rules are fixed: a child's profile must never see an adult title, and nobody should be offered what they already finished. You're a data scientist on the discovery team, filling that row.
Your task
Recommend ten titles, in order, for every viewing profile using the viewing history up to August 31, 2025, and beat a most-popular baseline on the two weeks that follow.
Instructions
- 1Load and clean the viewing data, handling repeated rows and profiles that watched the same title more than once.
- 2Decide what counts as a watch. Some sessions are a few minutes long, which says the viewer did not want it, so choose a rule from minutes watched against runtime and justify where you put the line.
- 3Build the most-popular baseline first and score it on the two weeks after the history ends, so you know what you have to beat.
- 4Build at least two recommenders and compare them. Titles watched by the same profiles is one approach, and a profile's genre history against the catalog is another.
- 5Apply the rules: a profile set up for a child may only be offered titles rated G, TV-Y, TV-G or PG, and no profile should be offered a title it already watched through.
- 6Check how your recommender treats the titles added in the last month of history, which have almost no viewing behind them, and say what you did about it.
- 7Score on the held-out weeks with recall at ten, and with a rank-aware measure such as NDCG, since the first slot is worth more than the tenth. Save recommendations.csv with the columns profile_id, rank and title_id.
Datasets
All files come in one download.
views.csv
About 26,000 viewing sessions from April 1 to August 31, 2025.
25,583 rows · 6 columns · 1.3 MB
| Column | Type | Description |
|---|---|---|
| view_id | integer | Unique ID of the viewing session. |
| profile_id | text | The profile that watched. |
| title_id | text | The title watched. |
| started_at | datetime | When the session started. |
| minutes_watched | integer | Minutes watched in the session. Can be more than one episode's runtime for a series, where people watch several in a sitting. |
| device | text | fire_tv, smart_tv, mobile, web or tablet. |
Preview the first 5 rowsHide preview
| view_id | profile_id | title_id | started_at | minutes_watched | device |
|---|---|---|---|---|---|
| 9100001 | PR40000 | T1238 | 2025-08-01 08:53:00 | 130 | tablet |
| 9100002 | PR40000 | T1088 | 2025-04-29 07:29:00 | 58 | tablet |
| 9100003 | PR40000 | T1113 | 2025-06-27 13:53:00 | 176 | tablet |
| 9100004 | PR40000 | T1271 | 2025-05-26 17:20:00 | 85 | tablet |
| 9100005 | PR40001 | T1115 | 2025-05-16 19:14:00 | 73 | fire_tv |
titles.csv
The 600 titles in the catalog, including 40 added during August 2025.
600 rows · 9 columns · 40 KB
| Column | Type | Description |
|---|---|---|
| title_id | text | Unique ID of the title. |
| title_name | text | Name of the title. |
| title_type | text | movie or series. |
| genres | text | One or two genres, separated by a vertical bar. |
| release_year | integer | Year the title was released. |
| runtime_minutes | integer | Runtime of a movie, or of a typical episode for a series. |
| maturity_rating | text | G, TV-Y, TV-G, PG, PG-13, TV-14, R or TV-MA. |
| added_on | date | Date the title was added to the catalog. |
| is_original | text | Whether the title is an original production: yes or no. |
Preview the first 5 rowsHide preview
| title_id | title_name | title_type | genres | release_year | runtime_minutes | maturity_rating | added_on | is_original |
|---|---|---|---|---|---|---|---|---|
| T1000 | Killing Eve | series | thriller|drama | 2018 | 42 | TV-14 | 2024-11-09 | no |
| T1001 | Crazy Rich Asians | movie | comedy|romance | 2018 | 120 | PG-13 | 2022-04-18 | no |
| T1002 | Thor: Ragnarok | movie | action|comedy | 2017 | 130 | PG-13 | 2025-02-17 | no |
| T1003 | My Neighbor Totoro | movie | kids|drama | 1988 | 86 | G | 2024-11-18 | no |
| T1004 | Being the Ricardos | movie | drama | 2021 | 131 | R | 2022-03-05 | yes |
profiles.csv
The 2,000 viewing profiles, several to a household.
2,000 rows · 5 columns · 57 KB
| Column | Type | Description |
|---|---|---|
| profile_id | text | Unique ID of the profile. |
| household_id | text | The account the profile belongs to. Profiles in one household share a subscription. |
| country | text | Country the account is registered in. |
| signup_month | month | Month the account was created. |
| is_kids_profile | text | Whether the profile is set up for a child: yes or no. |
Preview the first 5 rowsHide preview
| profile_id | household_id | country | signup_month | is_kids_profile |
|---|---|---|---|---|
| PR40000 | H70002 | IN | 2025-02 | no |
| PR40001 | H70002 | US | 2019-04 | no |
| PR40002 | H70002 | IN | 2023-09 | yes |
| PR40003 | H70003 | US | 2022-12 | no |
| PR40004 | H70003 | US | 2021-11 | no |
Hints
Score the popularity baseline before building anything else. It takes a few lines and it is the number your work has to be worth.
popular = watched.groupby("title_id")["profile_id"].nunique().sort_values(ascending=False)
popular.head(10).indexDividing a title's co-viewing score by how popular it is stops every recommendation collapsing back onto the same ten blockbusters.
score = co_watch_count / np.sqrt(title_popularity)
Deliverable
A public GitHub repo with your analysis (a notebook or scripts), recommendations.csv with ten ranked titles per profile, and a README with your rule for what counts as a watch, your comparison against the popularity baseline, and how you handled new titles.
When you're done, post your repo in the Solutions tab to share it with other learners.
What grading checks
Use this checklist to review your own work before you post and share it.
- Submitted GitHub repo is public and reachable.
- Repo contains at least one notebook or script file.
- recommendations.csv has exactly ten distinct titles, ranked 1 to 10, for every profile.
- No profile set up for a child is offered a title rated above PG, and no profile is offered a title it already watched through.
- Recall at ten on the held-out weeks reaches at least 0.13, against 0.113 for recommending the most popular titles to everybody.
- A rule for what counts as a watch is chosen from minutes watched against runtime and justified, and at least two recommenders are compared against the popularity baseline.
- The titles added in the last month can be recommended at all, and a rank-aware measure such as NDCG is reported alongside recall.