{"cells":[{"metadata":{},"cell_type":"markdown","source":"# 1. Introduction \n\nThe goal of this project is to develop a content-based recommendation engine for movies and TV shows on Netflix. I will compare two different methods:\n\n1. Using *cast, director, country, rating and genres* as features.\n2. Using the words in the movie/TV show *descriptions* as features."},{"metadata":{},"cell_type":"markdown","source":"# 2. Imports"},{"metadata":{"trusted":true},"cell_type":"code","source":"import numpy as np\nimport pandas as pd\nimport re\n\nimport nltk\nfrom nltk.corpus import stopwords\nnltk.download('stopwords')\nfrom nltk.tokenize import word_tokenize","execution_count":2,"outputs":[{"output_type":"stream","text":"[nltk_data] Downloading package stopwords to /usr/share/nltk_data...\n[nltk_data] Package stopwords is already up-to-date!\n","name":"stdout"}]},{"metadata":{},"cell_type":"markdown","source":"# 3. Loading data"},{"metadata":{"trusted":true},"cell_type":"code","source":"data = pd.read_csv('../input/netflix-shows/netflix_titles.csv')\ndata.head()","execution_count":3,"outputs":[{"output_type":"execute_result","execution_count":3,"data":{"text/plain":" show_id type title director \\\n0 s1 TV Show 3% NaN \n1 s2 Movie 7:19 Jorge Michel Grau \n2 s3 Movie 23:59 Gilbert Chan \n3 s4 Movie 9 Shane Acker \n4 s5 Movie 21 Robert Luketic \n\n cast country \\\n0 João Miguel, Bianca Comparato, Michel Gomes, R... Brazil \n1 Demián Bichir, Héctor Bonilla, Oscar Serrano, ... Mexico \n2 Tedd Chan, Stella Chung, Henley Hii, Lawrence ... Singapore \n3 Elijah Wood, John C. Reilly, Jennifer Connelly... United States \n4 Jim Sturgess, Kevin Spacey, Kate Bosworth, Aar... United States \n\n date_added release_year rating duration \\\n0 August 14, 2020 2020 TV-MA 4 Seasons \n1 December 23, 2016 2016 TV-MA 93 min \n2 December 20, 2018 2011 R 78 min \n3 November 16, 2017 2009 PG-13 80 min \n4 January 1, 2020 2008 PG-13 123 min \n\n listed_in \\\n0 International TV Shows, TV Dramas, TV Sci-Fi &... \n1 Dramas, International Movies \n2 Horror Movies, International Movies \n3 Action & Adventure, Independent Movies, Sci-Fi... \n4 Dramas \n\n description \n0 In a future where the elite inhabit an island ... \n1 After a devastating earthquake hits Mexico Cit... \n2 When an army recruit is found dead, his fellow... \n3 In a postapocalyptic world, rag-doll robots hi... \n4 A brilliant group of students become card-coun... ","text/html":"
\n\n
\n \n \n | \n show_id | \n type | \n title | \n director | \n cast | \n country | \n date_added | \n release_year | \n rating | \n duration | \n listed_in | \n description | \n
\n \n \n \n 0 | \n s1 | \n TV Show | \n 3% | \n NaN | \n João Miguel, Bianca Comparato, Michel Gomes, R... | \n Brazil | \n August 14, 2020 | \n 2020 | \n TV-MA | \n 4 Seasons | \n International TV Shows, TV Dramas, TV Sci-Fi &... | \n In a future where the elite inhabit an island ... | \n
\n \n 1 | \n s2 | \n Movie | \n 7:19 | \n Jorge Michel Grau | \n Demián Bichir, Héctor Bonilla, Oscar Serrano, ... | \n Mexico | \n December 23, 2016 | \n 2016 | \n TV-MA | \n 93 min | \n Dramas, International Movies | \n After a devastating earthquake hits Mexico Cit... | \n
\n \n 2 | \n s3 | \n Movie | \n 23:59 | \n Gilbert Chan | \n Tedd Chan, Stella Chung, Henley Hii, Lawrence ... | \n Singapore | \n December 20, 2018 | \n 2011 | \n R | \n 78 min | \n Horror Movies, International Movies | \n When an army recruit is found dead, his fellow... | \n
\n \n 3 | \n s4 | \n Movie | \n 9 | \n Shane Acker | \n Elijah Wood, John C. Reilly, Jennifer Connelly... | \n United States | \n November 16, 2017 | \n 2009 | \n PG-13 | \n 80 min | \n Action & Adventure, Independent Movies, Sci-Fi... | \n In a postapocalyptic world, rag-doll robots hi... | \n
\n \n 4 | \n s5 | \n Movie | \n 21 | \n Robert Luketic | \n Jim Sturgess, Kevin Spacey, Kate Bosworth, Aar... | \n United States | \n January 1, 2020 | \n 2008 | \n PG-13 | \n 123 min | \n Dramas | \n A brilliant group of students become card-coun... | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"data.groupby('type').count()","execution_count":4,"outputs":[{"output_type":"execute_result","execution_count":4,"data":{"text/plain":" show_id title director cast country date_added release_year \\\ntype \nMovie 5377 5377 5214 4951 5147 5377 5377 \nTV Show 2410 2410 184 2118 2133 2400 2410 \n\n rating duration listed_in description \ntype \nMovie 5372 5377 5377 5377 \nTV Show 2408 2410 2410 2410 ","text/html":"\n\n
\n \n \n | \n show_id | \n title | \n director | \n cast | \n country | \n date_added | \n release_year | \n rating | \n duration | \n listed_in | \n description | \n
\n \n type | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n
\n \n \n \n Movie | \n 5377 | \n 5377 | \n 5214 | \n 4951 | \n 5147 | \n 5377 | \n 5377 | \n 5372 | \n 5377 | \n 5377 | \n 5377 | \n
\n \n TV Show | \n 2410 | \n 2410 | \n 184 | \n 2118 | \n 2133 | \n 2400 | \n 2410 | \n 2408 | \n 2410 | \n 2410 | \n 2410 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"data = data.dropna(subset=['cast', 'country', 'rating'])","execution_count":5,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# 4. Developing Recommendation Engine using *cast, director, country, rating and genres*"},{"metadata":{"trusted":true},"cell_type":"code","source":"movies = data[data['type'] == 'Movie'].reset_index()\nmovies = movies.drop(['index', 'show_id', 'type', 'date_added', 'release_year', 'duration', 'description'], axis=1)\nmovies.head()","execution_count":6,"outputs":[{"output_type":"execute_result","execution_count":6,"data":{"text/plain":" title director \\\n0 7:19 Jorge Michel Grau \n1 23:59 Gilbert Chan \n2 9 Shane Acker \n3 21 Robert Luketic \n4 122 Yasir Al Yasiri \n\n cast country rating \\\n0 Demián Bichir, Héctor Bonilla, Oscar Serrano, ... Mexico TV-MA \n1 Tedd Chan, Stella Chung, Henley Hii, Lawrence ... Singapore R \n2 Elijah Wood, John C. Reilly, Jennifer Connelly... United States PG-13 \n3 Jim Sturgess, Kevin Spacey, Kate Bosworth, Aar... United States PG-13 \n4 Amina Khalil, Ahmed Dawood, Tarek Lotfy, Ahmed... Egypt TV-MA \n\n listed_in \n0 Dramas, International Movies \n1 Horror Movies, International Movies \n2 Action & Adventure, Independent Movies, Sci-Fi... \n3 Dramas \n4 Horror Movies, International Movies ","text/html":"\n\n
\n \n \n | \n title | \n director | \n cast | \n country | \n rating | \n listed_in | \n
\n \n \n \n 0 | \n 7:19 | \n Jorge Michel Grau | \n Demián Bichir, Héctor Bonilla, Oscar Serrano, ... | \n Mexico | \n TV-MA | \n Dramas, International Movies | \n
\n \n 1 | \n 23:59 | \n Gilbert Chan | \n Tedd Chan, Stella Chung, Henley Hii, Lawrence ... | \n Singapore | \n R | \n Horror Movies, International Movies | \n
\n \n 2 | \n 9 | \n Shane Acker | \n Elijah Wood, John C. Reilly, Jennifer Connelly... | \n United States | \n PG-13 | \n Action & Adventure, Independent Movies, Sci-Fi... | \n
\n \n 3 | \n 21 | \n Robert Luketic | \n Jim Sturgess, Kevin Spacey, Kate Bosworth, Aar... | \n United States | \n PG-13 | \n Dramas | \n
\n \n 4 | \n 122 | \n Yasir Al Yasiri | \n Amina Khalil, Ahmed Dawood, Tarek Lotfy, Ahmed... | \n Egypt | \n TV-MA | \n Horror Movies, International Movies | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"tv = data[data['type'] == 'TV Show'].reset_index()\ntv = tv.drop(['index', 'show_id', 'type', 'date_added', 'release_year', 'duration', 'description'], axis=1)\ntv.head()","execution_count":7,"outputs":[{"output_type":"execute_result","execution_count":7,"data":{"text/plain":" title director \\\n0 3% NaN \n1 46 Serdar Akar \n2 1983 NaN \n3 SAINT SEIYA: Knights of the Zodiac NaN \n4 #blackAF NaN \n\n cast country \\\n0 João Miguel, Bianca Comparato, Michel Gomes, R... Brazil \n1 Erdal Beşikçioğlu, Yasemin Allen, Melis Birkan... Turkey \n2 Robert Więckiewicz, Maciej Musiał, Michalina O... Poland, United States \n3 Bryson Baugus, Emily Neves, Blake Shepard, Pat... Japan \n4 Kenya Barris, Rashida Jones, Iman Benson, Genn... United States \n\n rating listed_in \n0 TV-MA International TV Shows, TV Dramas, TV Sci-Fi &... \n1 TV-MA International TV Shows, TV Dramas, TV Mysteries \n2 TV-MA Crime TV Shows, International TV Shows, TV Dramas \n3 TV-14 Anime Series, International TV Shows \n4 TV-MA TV Comedies ","text/html":"\n\n
\n \n \n | \n title | \n director | \n cast | \n country | \n rating | \n listed_in | \n
\n \n \n \n 0 | \n 3% | \n NaN | \n João Miguel, Bianca Comparato, Michel Gomes, R... | \n Brazil | \n TV-MA | \n International TV Shows, TV Dramas, TV Sci-Fi &... | \n
\n \n 1 | \n 46 | \n Serdar Akar | \n Erdal Beşikçioğlu, Yasemin Allen, Melis Birkan... | \n Turkey | \n TV-MA | \n International TV Shows, TV Dramas, TV Mysteries | \n
\n \n 2 | \n 1983 | \n NaN | \n Robert Więckiewicz, Maciej Musiał, Michalina O... | \n Poland, United States | \n TV-MA | \n Crime TV Shows, International TV Shows, TV Dramas | \n
\n \n 3 | \n SAINT SEIYA: Knights of the Zodiac | \n NaN | \n Bryson Baugus, Emily Neves, Blake Shepard, Pat... | \n Japan | \n TV-14 | \n Anime Series, International TV Shows | \n
\n \n 4 | \n #blackAF | \n NaN | \n Kenya Barris, Rashida Jones, Iman Benson, Genn... | \n United States | \n TV-MA | \n TV Comedies | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"actors = []\n\nfor i in movies['cast']:\n actor = re.split(r', \\s*', i)\n actors.append(actor)\n \nflat_list = []\nfor sublist in actors:\n for item in sublist:\n flat_list.append(item)\n \nactors_list = sorted(set(flat_list))\n\nbinary_actors = [[0] * 0 for i in range(len(set(flat_list)))]\n\nfor i in movies['cast']:\n k = 0\n for j in actors_list:\n if j in i:\n binary_actors[k].append(1.0)\n else:\n binary_actors[k].append(0.0)\n k+=1\n \nbinary_actors = pd.DataFrame(binary_actors).transpose()\n \ndirectors = []\n\nfor i in movies['director']:\n if pd.notna(i):\n director = re.split(r', \\s*', i)\n directors.append(director)\n \nflat_list2 = []\nfor sublist in directors:\n for item in sublist:\n flat_list2.append(item)\n \ndirectors_list = sorted(set(flat_list2))\n\nbinary_directors = [[0] * 0 for i in range(len(set(flat_list2)))]\n\nfor i in movies['director']:\n k = 0\n for j in directors_list:\n if pd.isna(i):\n binary_directors[k].append(0.0)\n elif j in i:\n binary_directors[k].append(1.0)\n else:\n binary_directors[k].append(0.0)\n k+=1\n \nbinary_directors = pd.DataFrame(binary_directors).transpose()\n \ncountries = []\n\nfor i in movies['country']:\n country = re.split(r', \\s*', i)\n countries.append(country)\n \nflat_list3 = []\nfor sublist in countries:\n for item in sublist:\n flat_list3.append(item)\n \ncountries_list = sorted(set(flat_list3))\n\nbinary_countries = [[0] * 0 for i in range(len(set(flat_list3)))]\n\nfor i in movies['country']:\n k = 0\n for j in countries_list:\n if j in i:\n binary_countries[k].append(1.0)\n else:\n binary_countries[k].append(0.0)\n k+=1\n \nbinary_countries = pd.DataFrame(binary_countries).transpose()\n\ngenres = []\n\nfor i in movies['listed_in']:\n genre = re.split(r', \\s*', i)\n genres.append(genre)\n \nflat_list4 = []\nfor sublist in genres:\n for item in sublist:\n flat_list4.append(item)\n \ngenres_list = sorted(set(flat_list4))\n\nbinary_genres = [[0] * 0 for i in range(len(set(flat_list4)))]\n\nfor i in movies['listed_in']:\n k = 0\n for j in genres_list:\n if j in i:\n binary_genres[k].append(1.0)\n else:\n binary_genres[k].append(0.0)\n k+=1\n \nbinary_genres = pd.DataFrame(binary_genres).transpose()\n\nratings = []\n\nfor i in movies['rating']:\n ratings.append(i)\n\nratings_list = sorted(set(ratings))\n\nbinary_ratings = [[0] * 0 for i in range(len(set(ratings_list)))]\n\nfor i in movies['rating']:\n k = 0\n for j in ratings_list:\n if j in i:\n binary_ratings[k].append(1.0)\n else:\n binary_ratings[k].append(0.0)\n k+=1\n \nbinary_ratings = pd.DataFrame(binary_ratings).transpose()","execution_count":33,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"binary = pd.concat([binary_actors, binary_directors, binary_countries, binary_genres], axis=1,ignore_index=True)\nbinary","execution_count":39,"outputs":[{"output_type":"execute_result","execution_count":39,"data":{"text/plain":" 0 1 2 3 4 5 6 7 8 9 \\\n0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 \n1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 \n2 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 \n3 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 \n4 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 \n... ... ... ... ... ... ... ... ... ... ... \n4756 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 \n4757 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 \n4758 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 \n4759 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 \n4760 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 \n\n ... 26570 26571 26572 26573 26574 26575 26576 26577 26578 \\\n0 ... 0.0 1.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 \n1 ... 0.0 1.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 \n2 ... 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 \n3 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 \n4 ... 0.0 1.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 \n... ... ... ... ... ... ... ... ... ... ... \n4756 ... 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 \n4757 ... 1.0 1.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 \n4758 ... 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 \n4759 ... 0.0 1.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 \n4760 ... 0.0 1.0 0.0 1.0 1.0 0.0 0.0 0.0 0.0 \n\n 26579 \n0 0.0 \n1 0.0 \n2 0.0 \n3 0.0 \n4 0.0 \n... ... \n4756 0.0 \n4757 0.0 \n4758 0.0 \n4759 0.0 \n4760 0.0 \n\n[4761 rows x 26580 columns]","text/html":"\n\n
\n \n \n | \n 0 | \n 1 | \n 2 | \n 3 | \n 4 | \n 5 | \n 6 | \n 7 | \n 8 | \n 9 | \n ... | \n 26570 | \n 26571 | \n 26572 | \n 26573 | \n 26574 | \n 26575 | \n 26576 | \n 26577 | \n 26578 | \n 26579 | \n
\n \n \n \n 0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n ... | \n 0.0 | \n 1.0 | \n 0.0 | \n 1.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n
\n \n 1 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n ... | \n 0.0 | \n 1.0 | \n 0.0 | \n 1.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n
\n \n 2 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n ... | \n 1.0 | \n 0.0 | \n 0.0 | \n 1.0 | \n 0.0 | \n 0.0 | \n 1.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n
\n \n 3 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n ... | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n
\n \n 4 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n ... | \n 0.0 | \n 1.0 | \n 0.0 | \n 1.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n
\n \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n
\n \n 4756 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n ... | \n 0.0 | \n 0.0 | \n 0.0 | \n 1.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n
\n \n 4757 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n ... | \n 1.0 | \n 1.0 | \n 0.0 | \n 1.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n
\n \n 4758 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n ... | \n 0.0 | \n 0.0 | \n 0.0 | \n 1.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n
\n \n 4759 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n ... | \n 0.0 | \n 1.0 | \n 0.0 | \n 1.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n
\n \n 4760 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n ... | \n 0.0 | \n 1.0 | \n 0.0 | \n 1.0 | \n 1.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n
\n \n
\n
4761 rows × 26580 columns
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"actors2 = []\n\nfor i in tv['cast']:\n actor2 = re.split(r', \\s*', i)\n actors2.append(actor2)\n \nflat_list5 = []\nfor sublist in actors2:\n for item in sublist:\n flat_list5.append(item)\n \nactors_list2 = sorted(set(flat_list5))\n\nbinary_actors2 = [[0] * 0 for i in range(len(set(flat_list5)))]\n\nfor i in tv['cast']:\n k = 0\n for j in actors_list2:\n if j in i:\n binary_actors2[k].append(1.0)\n else:\n binary_actors2[k].append(0.0)\n k+=1\n \nbinary_actors2 = pd.DataFrame(binary_actors2).transpose()\n \n\ncountries2 = []\n\nfor i in tv['country']:\n country2 = re.split(r', \\s*', i)\n countries2.append(country2)\n \nflat_list6 = []\nfor sublist in countries2:\n for item in sublist:\n flat_list6.append(item)\n \ncountries_list2 = sorted(set(flat_list6))\n\nbinary_countries2 = [[0] * 0 for i in range(len(set(flat_list6)))]\n\nfor i in tv['country']:\n k = 0\n for j in countries_list2:\n if j in i:\n binary_countries2[k].append(1.0)\n else:\n binary_countries2[k].append(0.0)\n k+=1\n \nbinary_countries2 = pd.DataFrame(binary_countries2).transpose()\n\ngenres2 = []\n\nfor i in tv['listed_in']:\n genre2 = re.split(r', \\s*', i)\n genres2.append(genre2)\n \nflat_list7 = []\nfor sublist in genres2:\n for item in sublist:\n flat_list7.append(item)\n \ngenres_list2 = sorted(set(flat_list7))\n\nbinary_genres2 = [[0] * 0 for i in range(len(set(flat_list7)))]\n\nfor i in tv['listed_in']:\n k = 0\n for j in genres_list2:\n if j in i:\n binary_genres2[k].append(1.0)\n else:\n binary_genres2[k].append(0.0)\n k+=1\n \nbinary_genres2 = pd.DataFrame(binary_genres2).transpose()\n\nratings2 = []\n\nfor i in tv['rating']:\n ratings2.append(i)\n\nratings_list2 = sorted(set(ratings2))\n\nbinary_ratings2 = [[0] * 0 for i in range(len(set(ratings_list2)))]\n\nfor i in tv['rating']:\n k = 0\n for j in ratings_list2:\n if j in i:\n binary_ratings2[k].append(1.0)\n else:\n binary_ratings2[k].append(0.0)\n k+=1\n \nbinary_ratings2 = pd.DataFrame(binary_ratings2).transpose()","execution_count":40,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"binary2 = pd.concat([binary_actors2, binary_countries2, binary_genres2], axis=1, ignore_index=True)\nbinary2","execution_count":41,"outputs":[{"output_type":"execute_result","execution_count":41,"data":{"text/plain":" 0 1 2 3 4 5 6 7 8 9 \\\n0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 \n1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 \n2 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 \n3 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 \n4 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 \n... ... ... ... ... ... ... ... ... ... ... \n1886 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 \n1887 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 \n1888 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 \n1889 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 \n1890 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 \n\n ... 12741 12742 12743 12744 12745 12746 12747 12748 12749 \\\n0 ... 0.0 0.0 0.0 1.0 0.0 0.0 1.0 1.0 0.0 \n1 ... 0.0 0.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 \n2 ... 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.0 \n3 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 \n4 ... 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 \n... ... ... ... ... ... ... ... ... ... ... \n1886 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 \n1887 ... 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.0 \n1888 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 \n1889 ... 1.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 \n1890 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 \n\n 12750 \n0 0.0 \n1 0.0 \n2 0.0 \n3 0.0 \n4 0.0 \n... ... \n1886 0.0 \n1887 0.0 \n1888 0.0 \n1889 0.0 \n1890 0.0 \n\n[1891 rows x 12751 columns]","text/html":"\n\n
\n \n \n | \n 0 | \n 1 | \n 2 | \n 3 | \n 4 | \n 5 | \n 6 | \n 7 | \n 8 | \n 9 | \n ... | \n 12741 | \n 12742 | \n 12743 | \n 12744 | \n 12745 | \n 12746 | \n 12747 | \n 12748 | \n 12749 | \n 12750 | \n
\n \n \n \n 0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n ... | \n 0.0 | \n 0.0 | \n 0.0 | \n 1.0 | \n 0.0 | \n 0.0 | \n 1.0 | \n 1.0 | \n 0.0 | \n 0.0 | \n
\n \n 1 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n ... | \n 0.0 | \n 0.0 | \n 0.0 | \n 1.0 | \n 0.0 | \n 1.0 | \n 0.0 | \n 1.0 | \n 0.0 | \n 0.0 | \n
\n \n 2 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n ... | \n 0.0 | \n 0.0 | \n 0.0 | \n 1.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 1.0 | \n 0.0 | \n 0.0 | \n
\n \n 3 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n ... | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 1.0 | \n 0.0 | \n 0.0 | \n
\n \n 4 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n ... | \n 0.0 | \n 0.0 | \n 1.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n
\n \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n ... | \n
\n \n 1886 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n ... | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n
\n \n 1887 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n ... | \n 0.0 | \n 0.0 | \n 0.0 | \n 1.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 1.0 | \n 0.0 | \n 0.0 | \n
\n \n 1888 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n ... | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n
\n \n 1889 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n ... | \n 1.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 1.0 | \n 0.0 | \n 0.0 | \n
\n \n 1890 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n ... | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 0.0 | \n 1.0 | \n 0.0 | \n 0.0 | \n
\n \n
\n
1891 rows × 12751 columns
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"def recommender(search):\n cs_list = []\n binary_list = []\n if search in movies['title'].values:\n idx = movies[movies['title'] == search].index.item()\n for i in binary.iloc[idx]:\n binary_list.append(i)\n point1 = np.array(binary_list).reshape(1, -1)\n point1 = [val for sublist in point1 for val in sublist] \n for j in range(len(movies)):\n binary_list2 = []\n for k in binary.iloc[j]:\n binary_list2.append(k)\n point2 = np.array(binary_list2).reshape(1, -1)\n point2 = [val for sublist in point2 for val in sublist]\n dot_product = np.dot(point1, point2)\n norm_1 = np.linalg.norm(point1)\n norm_2 = np.linalg.norm(point2)\n cos_sim = dot_product / (norm_1 * norm_2)\n cs_list.append(cos_sim)\n movies_copy = movies.copy()\n movies_copy['cos_sim'] = cs_list\n results = movies_copy.sort_values('cos_sim', ascending=False)\n results = results[results['title'] != search] \n top_results = results.head(5)\n return(top_results)\n elif search in tv['title'].values:\n idx = tv[tv['title'] == search].index.item()\n for i in binary2.iloc[idx]:\n binary_list.append(i)\n point1 = np.array(binary_list).reshape(1, -1)\n point1 = [val for sublist in point1 for val in sublist]\n for j in range(len(tv)):\n binary_list2 = []\n for k in binary2.iloc[j]:\n binary_list2.append(k)\n point2 = np.array(binary_list2).reshape(1, -1)\n point2 = [val for sublist in point2 for val in sublist]\n dot_product = np.dot(point1, point2)\n norm_1 = np.linalg.norm(point1)\n norm_2 = np.linalg.norm(point2)\n cos_sim = dot_product / (norm_1 * norm_2)\n cs_list.append(cos_sim)\n tv_copy = tv.copy()\n tv_copy['cos_sim'] = cs_list\n results = tv_copy.sort_values('cos_sim', ascending=False)\n results = results[results['title'] != search] \n top_results = results.head(5)\n return(top_results)\n else:\n return(\"Title not in dataset. Please check spelling.\")","execution_count":42,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"## 4.1. Recommending Movies"},{"metadata":{"trusted":true},"cell_type":"code","source":"recommender('The Conjuring')","execution_count":43,"outputs":[{"output_type":"execute_result","execution_count":43,"data":{"text/plain":" title director \\\n1868 Insidious James Wan \n968 Creep Patrick Brice \n1844 In the Tall Grass Vincenzo Natali \n969 Creep 2 Patrick Brice \n1077 Desolation Sam Patton \n\n cast \\\n1868 Patrick Wilson, Rose Byrne, Lin Shaye, Ty Simp... \n968 Mark Duplass, Patrick Brice \n1844 Patrick Wilson, Laysla De Oliveira, Avery Whit... \n969 Mark Duplass, Desiree Akhavan, Karan Soni \n1077 Jaimi Paige, Alyshia Ochse, Toby Nichols, Clau... \n\n country rating \\\n1868 United States, Canada, United Kingdom PG-13 \n968 United States R \n1844 Canada, United States TV-MA \n969 United States TV-MA \n1077 United States TV-MA \n\n listed_in cos_sim \n1868 Horror Movies, Thrillers 0.388922 \n968 Horror Movies, Independent Movies, Thrillers 0.377964 \n1844 Horror Movies, Thrillers 0.370625 \n969 Horror Movies, Independent Movies, Thrillers 0.356348 \n1077 Horror Movies, Thrillers 0.356348 ","text/html":"\n\n
\n \n \n | \n title | \n director | \n cast | \n country | \n rating | \n listed_in | \n cos_sim | \n
\n \n \n \n 1868 | \n Insidious | \n James Wan | \n Patrick Wilson, Rose Byrne, Lin Shaye, Ty Simp... | \n United States, Canada, United Kingdom | \n PG-13 | \n Horror Movies, Thrillers | \n 0.388922 | \n
\n \n 968 | \n Creep | \n Patrick Brice | \n Mark Duplass, Patrick Brice | \n United States | \n R | \n Horror Movies, Independent Movies, Thrillers | \n 0.377964 | \n
\n \n 1844 | \n In the Tall Grass | \n Vincenzo Natali | \n Patrick Wilson, Laysla De Oliveira, Avery Whit... | \n Canada, United States | \n TV-MA | \n Horror Movies, Thrillers | \n 0.370625 | \n
\n \n 969 | \n Creep 2 | \n Patrick Brice | \n Mark Duplass, Desiree Akhavan, Karan Soni | \n United States | \n TV-MA | \n Horror Movies, Independent Movies, Thrillers | \n 0.356348 | \n
\n \n 1077 | \n Desolation | \n Sam Patton | \n Jaimi Paige, Alyshia Ochse, Toby Nichols, Clau... | \n United States | \n TV-MA | \n Horror Movies, Thrillers | \n 0.356348 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"recommender(\"Child's Play\")","execution_count":44,"outputs":[{"output_type":"execute_result","execution_count":44,"data":{"text/plain":" title director \\\n975 Cult of Chucky Don Mancini \n4669 Wildling Fritz Böhm \n3592 Stephanie Akiva Goldsman \n789 Candyman Bernard Rose \n968 Creep Patrick Brice \n\n cast \\\n975 Fiona Dourif, Michael Therriault, Adam Hurtig,... \n4669 Bel Powley, Brad Dourif, Liv Tyler, Collin Kel... \n3592 Shree Cooks, Frank Grillo, Anna Torv \n789 Virginia Madsen, Tony Todd, Xander Berkeley, K... \n968 Mark Duplass, Patrick Brice \n\n country rating \\\n975 United States R \n4669 United States R \n3592 United States R \n789 United States, United Kingdom R \n968 United States R \n\n listed_in cos_sim \n975 Horror Movies 0.312500 \n4669 Horror Movies, Independent Movies, Sci-Fi & Fa... 0.301511 \n3592 Horror Movies 0.283473 \n789 Cult Movies, Horror Movies 0.267261 \n968 Horror Movies, Independent Movies, Thrillers 0.265165 ","text/html":"\n\n
\n \n \n | \n title | \n director | \n cast | \n country | \n rating | \n listed_in | \n cos_sim | \n
\n \n \n \n 975 | \n Cult of Chucky | \n Don Mancini | \n Fiona Dourif, Michael Therriault, Adam Hurtig,... | \n United States | \n R | \n Horror Movies | \n 0.312500 | \n
\n \n 4669 | \n Wildling | \n Fritz Böhm | \n Bel Powley, Brad Dourif, Liv Tyler, Collin Kel... | \n United States | \n R | \n Horror Movies, Independent Movies, Sci-Fi & Fa... | \n 0.301511 | \n
\n \n 3592 | \n Stephanie | \n Akiva Goldsman | \n Shree Cooks, Frank Grillo, Anna Torv | \n United States | \n R | \n Horror Movies | \n 0.283473 | \n
\n \n 789 | \n Candyman | \n Bernard Rose | \n Virginia Madsen, Tony Todd, Xander Berkeley, K... | \n United States, United Kingdom | \n R | \n Cult Movies, Horror Movies | \n 0.267261 | \n
\n \n 968 | \n Creep | \n Patrick Brice | \n Mark Duplass, Patrick Brice | \n United States | \n R | \n Horror Movies, Independent Movies, Thrillers | \n 0.265165 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"recommender('Charlie and the Chocolate Factory')","execution_count":45,"outputs":[{"output_type":"execute_result","execution_count":45,"data":{"text/plain":" title director \\\n3661 Sweeney Todd: The Demon Barber of Fleet Street Tim Burton \n1346 Figaro Pho Luke Jurevicius \n2983 Penelope Mark Palansky \n1557 Goosebumps 2: Haunted Halloween Ari Sandel \n1767 Hugo Martin Scorsese \n\n cast \\\n3661 Johnny Depp, Helena Bonham Carter, Alan Rickma... \n1346 Luke Jurevicius \n2983 Christina Ricci, James McAvoy, Catherine O'Har... \n1557 Jeremy Ray Taylor, Madison Iseman, Caleel Harr... \n1767 Ben Kingsley, Sacha Baron Cohen, Asa Butterfie... \n\n country rating \\\n3661 United States, United Kingdom R \n1346 United Kingdom TV-Y7 \n2983 United Kingdom, United States PG \n1557 United States, United Kingdom PG \n1767 United Kingdom, United States, France PG \n\n listed_in cos_sim \n3661 Dramas, Horror Movies, Music & Musicals 0.360041 \n1346 Children & Family Movies, Comedies 0.356348 \n2983 Children & Family Movies, Comedies, Romantic M... 0.314970 \n1557 Children & Family Movies, Comedies 0.302614 \n1767 Children & Family Movies, Dramas 0.293972 ","text/html":"\n\n
\n \n \n | \n title | \n director | \n cast | \n country | \n rating | \n listed_in | \n cos_sim | \n
\n \n \n \n 3661 | \n Sweeney Todd: The Demon Barber of Fleet Street | \n Tim Burton | \n Johnny Depp, Helena Bonham Carter, Alan Rickma... | \n United States, United Kingdom | \n R | \n Dramas, Horror Movies, Music & Musicals | \n 0.360041 | \n
\n \n 1346 | \n Figaro Pho | \n Luke Jurevicius | \n Luke Jurevicius | \n United Kingdom | \n TV-Y7 | \n Children & Family Movies, Comedies | \n 0.356348 | \n
\n \n 2983 | \n Penelope | \n Mark Palansky | \n Christina Ricci, James McAvoy, Catherine O'Har... | \n United Kingdom, United States | \n PG | \n Children & Family Movies, Comedies, Romantic M... | \n 0.314970 | \n
\n \n 1557 | \n Goosebumps 2: Haunted Halloween | \n Ari Sandel | \n Jeremy Ray Taylor, Madison Iseman, Caleel Harr... | \n United States, United Kingdom | \n PG | \n Children & Family Movies, Comedies | \n 0.302614 | \n
\n \n 1767 | \n Hugo | \n Martin Scorsese | \n Ben Kingsley, Sacha Baron Cohen, Asa Butterfie... | \n United Kingdom, United States, France | \n PG | \n Children & Family Movies, Dramas | \n 0.293972 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"recommender('Wild Child')","execution_count":46,"outputs":[{"output_type":"execute_result","execution_count":46,"data":{"text/plain":" title director \\\n4018 The Kissing Booth Vince Marcello \n2983 Penelope Mark Palansky \n4019 The Kissing Booth 2 Vince Marcello \n3959 The Guernsey Literary and Potato Peel Pie Society Mike Newell \n1714 Holidate John Whitesell \n\n cast \\\n4018 Joey King, Joel Courtney, Jacob Elordi, Molly ... \n2983 Christina Ricci, James McAvoy, Catherine O'Har... \n4019 Joey King, Joel Courtney, Jacob Elordi, Molly ... \n3959 Lily James, Michiel Huisman, Penelope Wilton, ... \n1714 Emma Roberts, Luke Bracey, Kristin Chenoweth, ... \n\n country rating \\\n4018 United Kingdom, United States TV-14 \n2983 United Kingdom, United States PG \n4019 United Kingdom, United States TV-14 \n3959 United Kingdom, France, United States TV-PG \n1714 United States TV-MA \n\n listed_in cos_sim \n4018 Comedies, Romantic Movies 0.353553 \n2983 Children & Family Movies, Comedies, Romantic M... 0.322749 \n4019 Comedies, Romantic Movies 0.310087 \n3959 Dramas, Romantic Movies 0.298807 \n1714 Comedies, Romantic Movies 0.298807 ","text/html":"\n\n
\n \n \n | \n title | \n director | \n cast | \n country | \n rating | \n listed_in | \n cos_sim | \n
\n \n \n \n 4018 | \n The Kissing Booth | \n Vince Marcello | \n Joey King, Joel Courtney, Jacob Elordi, Molly ... | \n United Kingdom, United States | \n TV-14 | \n Comedies, Romantic Movies | \n 0.353553 | \n
\n \n 2983 | \n Penelope | \n Mark Palansky | \n Christina Ricci, James McAvoy, Catherine O'Har... | \n United Kingdom, United States | \n PG | \n Children & Family Movies, Comedies, Romantic M... | \n 0.322749 | \n
\n \n 4019 | \n The Kissing Booth 2 | \n Vince Marcello | \n Joey King, Joel Courtney, Jacob Elordi, Molly ... | \n United Kingdom, United States | \n TV-14 | \n Comedies, Romantic Movies | \n 0.310087 | \n
\n \n 3959 | \n The Guernsey Literary and Potato Peel Pie Society | \n Mike Newell | \n Lily James, Michiel Huisman, Penelope Wilton, ... | \n United Kingdom, France, United States | \n TV-PG | \n Dramas, Romantic Movies | \n 0.298807 | \n
\n \n 1714 | \n Holidate | \n John Whitesell | \n Emma Roberts, Luke Bracey, Kristin Chenoweth, ... | \n United States | \n TV-MA | \n Comedies, Romantic Movies | \n 0.298807 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"recommender(\"Dr. Seuss' The Cat in the Hat\")","execution_count":47,"outputs":[{"output_type":"execute_result","execution_count":47,"data":{"text/plain":" title director \\\n2798 NOVA: Bird Brain NaN \n3624 Sugar High Ariel Boles \n4758 Zoom Peter Hewitt \n4624 What a Girl Wants Dennie Gordon \n3066 Prince of Peoria: A Christmas Moose Miracle Jon Rosenbaum \n\n cast \\\n2798 Craig Sechler \n3624 Hunter March \n4758 Tim Allen, Courteney Cox, Chevy Chase, Kate Ma... \n4624 Amanda Bynes, Colin Firth, Kelly Preston, Eile... \n3066 Gavin Lewis, Theodore Barnes, Shelby Simmons, ... \n\n country rating \\\n2798 United States TV-G \n3624 United States TV-G \n4758 United States PG \n4624 United States, United Kingdom PG \n3066 United States TV-G \n\n listed_in cos_sim \n2798 Children & Family Movies, Documentaries 0.372104 \n3624 Children & Family Movies 0.372104 \n4758 Children & Family Movies, Comedies 0.370625 \n4624 Children & Family Movies, Comedies 0.370625 \n3066 Children & Family Movies, Comedies 0.369800 ","text/html":"\n\n
\n \n \n | \n title | \n director | \n cast | \n country | \n rating | \n listed_in | \n cos_sim | \n
\n \n \n \n 2798 | \n NOVA: Bird Brain | \n NaN | \n Craig Sechler | \n United States | \n TV-G | \n Children & Family Movies, Documentaries | \n 0.372104 | \n
\n \n 3624 | \n Sugar High | \n Ariel Boles | \n Hunter March | \n United States | \n TV-G | \n Children & Family Movies | \n 0.372104 | \n
\n \n 4758 | \n Zoom | \n Peter Hewitt | \n Tim Allen, Courteney Cox, Chevy Chase, Kate Ma... | \n United States | \n PG | \n Children & Family Movies, Comedies | \n 0.370625 | \n
\n \n 4624 | \n What a Girl Wants | \n Dennie Gordon | \n Amanda Bynes, Colin Firth, Kelly Preston, Eile... | \n United States, United Kingdom | \n PG | \n Children & Family Movies, Comedies | \n 0.370625 | \n
\n \n 3066 | \n Prince of Peoria: A Christmas Moose Miracle | \n Jon Rosenbaum | \n Gavin Lewis, Theodore Barnes, Shelby Simmons, ... | \n United States | \n TV-G | \n Children & Family Movies, Comedies | \n 0.369800 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"recommender('Hook')","execution_count":48,"outputs":[{"output_type":"execute_result","execution_count":48,"data":{"text/plain":" title director \\\n477 Balto Simon Wells \n3624 Sugar High Ariel Boles \n2798 NOVA: Bird Brain NaN \n1001 Dance Dreams: Hot Chocolate Nutcracker Oliver Bokelberg \n562 Benji's Very Own Christmas Story Joe Camp \n\n cast country rating \\\n477 Kevin Bacon, Bob Hoskins, Bridget Fonda, Jim C... United States G \n3624 Hunter March United States TV-G \n2798 Craig Sechler United States TV-G \n1001 Debbie Allen United States TV-G \n562 Ron Moody, Patsy Garrett, Cynthia Smith United States TV-G \n\n listed_in cos_sim \n477 Children & Family Movies, Dramas 0.370625 \n3624 Children & Family Movies 0.358569 \n2798 Children & Family Movies, Documentaries 0.358569 \n1001 Children & Family Movies, Documentaries 0.327327 \n562 Children & Family Movies 0.303046 ","text/html":"\n\n
\n \n \n | \n title | \n director | \n cast | \n country | \n rating | \n listed_in | \n cos_sim | \n
\n \n \n \n 477 | \n Balto | \n Simon Wells | \n Kevin Bacon, Bob Hoskins, Bridget Fonda, Jim C... | \n United States | \n G | \n Children & Family Movies, Dramas | \n 0.370625 | \n
\n \n 3624 | \n Sugar High | \n Ariel Boles | \n Hunter March | \n United States | \n TV-G | \n Children & Family Movies | \n 0.358569 | \n
\n \n 2798 | \n NOVA: Bird Brain | \n NaN | \n Craig Sechler | \n United States | \n TV-G | \n Children & Family Movies, Documentaries | \n 0.358569 | \n
\n \n 1001 | \n Dance Dreams: Hot Chocolate Nutcracker | \n Oliver Bokelberg | \n Debbie Allen | \n United States | \n TV-G | \n Children & Family Movies, Documentaries | \n 0.327327 | \n
\n \n 562 | \n Benji's Very Own Christmas Story | \n Joe Camp | \n Ron Moody, Patsy Garrett, Cynthia Smith | \n United States | \n TV-G | \n Children & Family Movies | \n 0.303046 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"recommender('Holidate')","execution_count":49,"outputs":[{"output_type":"execute_result","execution_count":49,"data":{"text/plain":" title director \\\n4646 When We First Met Ari Sandel \n1360 First Impression Arthur Muhammad \n3606 Stranger than Fiction Marc Forster \n4018 The Kissing Booth Vince Marcello \n3946 The Good Catholic Paul Shoulberg \n\n cast \\\n4646 Adam DeVine, Alexandra Daddario, Shelley Henni... \n1360 Lamman Rucker, Lisa Arrindell Anderson, Elise ... \n3606 Will Ferrell, Maggie Gyllenhaal, Dustin Hoffma... \n4018 Joey King, Joel Courtney, Jacob Elordi, Molly ... \n3946 Zachary Spicer, Wrenn Schmidt, Danny Glover, J... \n\n country rating listed_in \\\n4646 United States TV-14 Comedies, Romantic Movies \n1360 United States TV-14 Comedies, Romantic Movies \n3606 United States, United Kingdom PG-13 Comedies, Romantic Movies \n4018 United Kingdom, United States TV-14 Comedies, Romantic Movies \n3946 United States PG-13 Comedies, Dramas, Romantic Movies \n\n cos_sim \n4646 0.422577 \n1360 0.356348 \n3606 0.345033 \n4018 0.338062 \n3946 0.338062 ","text/html":"\n\n
\n \n \n | \n title | \n director | \n cast | \n country | \n rating | \n listed_in | \n cos_sim | \n
\n \n \n \n 4646 | \n When We First Met | \n Ari Sandel | \n Adam DeVine, Alexandra Daddario, Shelley Henni... | \n United States | \n TV-14 | \n Comedies, Romantic Movies | \n 0.422577 | \n
\n \n 1360 | \n First Impression | \n Arthur Muhammad | \n Lamman Rucker, Lisa Arrindell Anderson, Elise ... | \n United States | \n TV-14 | \n Comedies, Romantic Movies | \n 0.356348 | \n
\n \n 3606 | \n Stranger than Fiction | \n Marc Forster | \n Will Ferrell, Maggie Gyllenhaal, Dustin Hoffma... | \n United States, United Kingdom | \n PG-13 | \n Comedies, Romantic Movies | \n 0.345033 | \n
\n \n 4018 | \n The Kissing Booth | \n Vince Marcello | \n Joey King, Joel Courtney, Jacob Elordi, Molly ... | \n United Kingdom, United States | \n TV-14 | \n Comedies, Romantic Movies | \n 0.338062 | \n
\n \n 3946 | \n The Good Catholic | \n Paul Shoulberg | \n Zachary Spicer, Wrenn Schmidt, Danny Glover, J... | \n United States | \n PG-13 | \n Comedies, Dramas, Romantic Movies | \n 0.338062 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{},"cell_type":"markdown","source":"## 4.2. Recommending TV shows"},{"metadata":{"trusted":true},"cell_type":"code","source":"recommender('After Life')","execution_count":50,"outputs":[{"output_type":"execute_result","execution_count":50,"data":{"text/plain":" title director \\\n468 Extras NaN \n1468 The Blue Planet: A Natural History of the Oceans Alastair Fothergill \n578 Grand Designs NaN \n1007 My Hotter Half NaN \n62 Ainsley Eats the Streets NaN \n\n cast \\\n468 Ricky Gervais, Stephen Merchant, Ashley Jensen... \n1468 David Attenborough \n578 Kevin McCloud \n1007 Melvin Odoom \n62 Ainsley Harriott \n\n country rating \\\n468 United Kingdom, United States TV-MA \n1468 United Kingdom TV-G \n578 United Kingdom TV-14 \n1007 United Kingdom TV-PG \n62 United Kingdom TV-PG \n\n listed_in cos_sim \n468 British TV Shows, TV Comedies 0.526235 \n1468 British TV Shows, Docuseries, International TV... 0.452911 \n578 British TV Shows, International TV Shows, Real... 0.452911 \n1007 British TV Shows, International TV Shows, Real... 0.452911 \n62 British TV Shows, Docuseries, International TV... 0.452911 ","text/html":"\n\n
\n \n \n | \n title | \n director | \n cast | \n country | \n rating | \n listed_in | \n cos_sim | \n
\n \n \n \n 468 | \n Extras | \n NaN | \n Ricky Gervais, Stephen Merchant, Ashley Jensen... | \n United Kingdom, United States | \n TV-MA | \n British TV Shows, TV Comedies | \n 0.526235 | \n
\n \n 1468 | \n The Blue Planet: A Natural History of the Oceans | \n Alastair Fothergill | \n David Attenborough | \n United Kingdom | \n TV-G | \n British TV Shows, Docuseries, International TV... | \n 0.452911 | \n
\n \n 578 | \n Grand Designs | \n NaN | \n Kevin McCloud | \n United Kingdom | \n TV-14 | \n British TV Shows, International TV Shows, Real... | \n 0.452911 | \n
\n \n 1007 | \n My Hotter Half | \n NaN | \n Melvin Odoom | \n United Kingdom | \n TV-PG | \n British TV Shows, International TV Shows, Real... | \n 0.452911 | \n
\n \n 62 | \n Ainsley Eats the Streets | \n NaN | \n Ainsley Harriott | \n United Kingdom | \n TV-PG | \n British TV Shows, Docuseries, International TV... | \n 0.452911 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"recommender('Anne with an E')","execution_count":51,"outputs":[{"output_type":"execute_result","execution_count":51,"data":{"text/plain":" title director \\\n254 Can You Hear Me? NaN \n1229 Restaurants on the Edge NaN \n185 Bitten NaN \n622 Heavy Rescue: 401 NaN \n645 Hip-Hop Evolution NaN \n\n cast country rating \\\n254 Mélissa Bédard, Ève Landry, Florence Longpré Canada TV-MA \n1229 Nick Liberato, Karin Bohn, Dennis Prescott Canada TV-14 \n185 Laura Vandervoort, Greyston Holt, Greg Bryk, S... Canada TV-MA \n622 Dave Pettitt Canada TV-MA \n645 Shad Kabango Canada TV-MA \n\n listed_in cos_sim \n254 International TV Shows, TV Comedies, TV Dramas 0.462250 \n1229 International TV Shows, Reality TV 0.392232 \n185 International TV Shows, TV Dramas, TV Horror 0.384615 \n622 International TV Shows, Reality TV 0.372104 \n645 Docuseries, International TV Shows 0.372104 ","text/html":"\n\n
\n \n \n | \n title | \n director | \n cast | \n country | \n rating | \n listed_in | \n cos_sim | \n
\n \n \n \n 254 | \n Can You Hear Me? | \n NaN | \n Mélissa Bédard, Ève Landry, Florence Longpré | \n Canada | \n TV-MA | \n International TV Shows, TV Comedies, TV Dramas | \n 0.462250 | \n
\n \n 1229 | \n Restaurants on the Edge | \n NaN | \n Nick Liberato, Karin Bohn, Dennis Prescott | \n Canada | \n TV-14 | \n International TV Shows, Reality TV | \n 0.392232 | \n
\n \n 185 | \n Bitten | \n NaN | \n Laura Vandervoort, Greyston Holt, Greg Bryk, S... | \n Canada | \n TV-MA | \n International TV Shows, TV Dramas, TV Horror | \n 0.384615 | \n
\n \n 622 | \n Heavy Rescue: 401 | \n NaN | \n Dave Pettitt | \n Canada | \n TV-MA | \n International TV Shows, Reality TV | \n 0.372104 | \n
\n \n 645 | \n Hip-Hop Evolution | \n NaN | \n Shad Kabango | \n Canada | \n TV-MA | \n Docuseries, International TV Shows | \n 0.372104 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"recommender('Gilmore Girls')","execution_count":52,"outputs":[{"output_type":"execute_result","execution_count":52,"data":{"text/plain":" title director \\\n542 Gilmore Girls: A Year in the Life NaN \n863 Love NaN \n1061 No Tomorrow NaN \n361 DASH & LILY NaN \n664 Hot Date NaN \n\n cast country rating \\\n542 Lauren Graham, Alexis Bledel, Kelly Bishop, Sc... United States TV-14 \n863 Gillian Jacobs, Paul Rust, Claudia O'Doherty United States TV-MA \n1061 Joshua Sasse, Tori Anderson, Jonathan Langdon,... United States TV-PG \n361 Midori Francis, Austin Abrams, Dante Brown, Tr... United States TV-14 \n664 Emily Axford, Brian Murphy United States TV-MA \n\n listed_in cos_sim \n542 TV Comedies, TV Dramas, Teen TV Shows 0.777778 \n863 Romantic TV Shows, TV Comedies, TV Dramas 0.416667 \n1061 Romantic TV Shows, TV Comedies, TV Dramas 0.408248 \n361 Romantic TV Shows, TV Comedies, TV Dramas 0.392837 \n664 Romantic TV Shows, TV Comedies 0.384900 ","text/html":"\n\n
\n \n \n | \n title | \n director | \n cast | \n country | \n rating | \n listed_in | \n cos_sim | \n
\n \n \n \n 542 | \n Gilmore Girls: A Year in the Life | \n NaN | \n Lauren Graham, Alexis Bledel, Kelly Bishop, Sc... | \n United States | \n TV-14 | \n TV Comedies, TV Dramas, Teen TV Shows | \n 0.777778 | \n
\n \n 863 | \n Love | \n NaN | \n Gillian Jacobs, Paul Rust, Claudia O'Doherty | \n United States | \n TV-MA | \n Romantic TV Shows, TV Comedies, TV Dramas | \n 0.416667 | \n
\n \n 1061 | \n No Tomorrow | \n NaN | \n Joshua Sasse, Tori Anderson, Jonathan Langdon,... | \n United States | \n TV-PG | \n Romantic TV Shows, TV Comedies, TV Dramas | \n 0.408248 | \n
\n \n 361 | \n DASH & LILY | \n NaN | \n Midori Francis, Austin Abrams, Dante Brown, Tr... | \n United States | \n TV-14 | \n Romantic TV Shows, TV Comedies, TV Dramas | \n 0.392837 | \n
\n \n 664 | \n Hot Date | \n NaN | \n Emily Axford, Brian Murphy | \n United States | \n TV-MA | \n Romantic TV Shows, TV Comedies | \n 0.384900 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"recommender('Friends')","execution_count":53,"outputs":[{"output_type":"execute_result","execution_count":53,"data":{"text/plain":" title director \\\n455 Episodes NaN \n1133 Pee-wee's Playhouse NaN \n513 Frasier NaN \n910 Man with a Plan NaN \n1550 The Honeymoon Stand Up Special NaN \n\n cast \\\n455 Matt LeBlanc, Tamsin Greig, Stephen Mangan, Ka... \n1133 Paul Reubens \n513 Kelsey Grammer, Jane Leeves, David Hyde Pierce... \n910 Matt LeBlanc, Liza Snyder, Grace Kaufman, Matt... \n1550 Natasha Leggero, Moshe Kasher \n\n country rating \\\n455 United Kingdom, United States TV-MA \n1133 United States TV-PG \n513 United States TV-PG \n910 United States TV-PG \n1550 United States TV-MA \n\n listed_in cos_sim \n455 Classic & Cult TV, TV Comedies 0.476731 \n1133 Classic & Cult TV, Kids' TV, TV Comedies 0.424264 \n513 Classic & Cult TV, TV Comedies 0.400000 \n910 TV Comedies 0.400000 \n1550 Stand-Up Comedy & Talk Shows, TV Comedies 0.387298 ","text/html":"\n\n
\n \n \n | \n title | \n director | \n cast | \n country | \n rating | \n listed_in | \n cos_sim | \n
\n \n \n \n 455 | \n Episodes | \n NaN | \n Matt LeBlanc, Tamsin Greig, Stephen Mangan, Ka... | \n United Kingdom, United States | \n TV-MA | \n Classic & Cult TV, TV Comedies | \n 0.476731 | \n
\n \n 1133 | \n Pee-wee's Playhouse | \n NaN | \n Paul Reubens | \n United States | \n TV-PG | \n Classic & Cult TV, Kids' TV, TV Comedies | \n 0.424264 | \n
\n \n 513 | \n Frasier | \n NaN | \n Kelsey Grammer, Jane Leeves, David Hyde Pierce... | \n United States | \n TV-PG | \n Classic & Cult TV, TV Comedies | \n 0.400000 | \n
\n \n 910 | \n Man with a Plan | \n NaN | \n Matt LeBlanc, Liza Snyder, Grace Kaufman, Matt... | \n United States | \n TV-PG | \n TV Comedies | \n 0.400000 | \n
\n \n 1550 | \n The Honeymoon Stand Up Special | \n NaN | \n Natasha Leggero, Moshe Kasher | \n United States | \n TV-MA | \n Stand-Up Comedy & Talk Shows, TV Comedies | \n 0.387298 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"recommender('Love on the Spectrum')","execution_count":54,"outputs":[{"output_type":"execute_result","execution_count":54,"data":{"text/plain":" title director cast \\\n278 Cheapest Weddings NaN Melanie Vallejo \n1890 Zumbo's Just Desserts NaN Adriano Zumbo, Rachel Khoo \n1782 Vai Anitta NaN Anitta \n326 Court Justice NaN Chris Bourke \n21 72 Dangerous Animals: Asia NaN Bob Brisbane \n\n country rating listed_in \\\n278 Australia TV-14 International TV Shows, Reality TV \n1890 Australia TV-PG International TV Shows, Reality TV \n1782 Brazil TV-MA Docuseries, International TV Shows, Reality TV \n326 Australia TV-MA Crime TV Shows, Docuseries, International TV S... \n21 Australia TV-14 Docuseries, International TV Shows, Science & ... \n\n cos_sim \n278 0.730297 \n1890 0.666667 \n1782 0.666667 \n326 0.666667 \n21 0.666667 ","text/html":"\n\n
\n \n \n | \n title | \n director | \n cast | \n country | \n rating | \n listed_in | \n cos_sim | \n
\n \n \n \n 278 | \n Cheapest Weddings | \n NaN | \n Melanie Vallejo | \n Australia | \n TV-14 | \n International TV Shows, Reality TV | \n 0.730297 | \n
\n \n 1890 | \n Zumbo's Just Desserts | \n NaN | \n Adriano Zumbo, Rachel Khoo | \n Australia | \n TV-PG | \n International TV Shows, Reality TV | \n 0.666667 | \n
\n \n 1782 | \n Vai Anitta | \n NaN | \n Anitta | \n Brazil | \n TV-MA | \n Docuseries, International TV Shows, Reality TV | \n 0.666667 | \n
\n \n 326 | \n Court Justice | \n NaN | \n Chris Bourke | \n Australia | \n TV-MA | \n Crime TV Shows, Docuseries, International TV S... | \n 0.666667 | \n
\n \n 21 | \n 72 Dangerous Animals: Asia | \n NaN | \n Bob Brisbane | \n Australia | \n TV-14 | \n Docuseries, International TV Shows, Science & ... | \n 0.666667 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"recommender('13 Reasons Why')","execution_count":55,"outputs":[{"output_type":"execute_result","execution_count":55,"data":{"text/plain":" title director \\\n11 13 Reasons Why: Beyond the Reasons NaN \n515 Frequency NaN \n1653 The Sinner NaN \n964 MINDHUNTER NaN \n1775 Unsolved NaN \n\n cast country rating \\\n11 Dylan Minnette, Katherine Langford, Kate Walsh... United States TV-MA \n515 Peyton List, Riley Smith, Mekhi Phifer, Devin ... United States TV-14 \n1653 Jessica Biel, Bill Pullman, Christopher Abbott... United States TV-MA \n964 Jonathan Groff, Holt McCallany, Anna Torv, Cot... United States TV-MA \n1775 Josh Duhamel, Jimmi Simpson, Bokeem Woodbine United States TV-MA \n\n listed_in cos_sim \n11 Crime TV Shows, Docuseries 0.432789 \n515 Crime TV Shows, TV Dramas, TV Mysteries 0.381771 \n1653 Crime TV Shows, TV Dramas, TV Mysteries 0.362738 \n964 Crime TV Shows, TV Dramas, TV Mysteries 0.362738 \n1775 Crime TV Shows, TV Dramas 0.346844 ","text/html":"\n\n
\n \n \n | \n title | \n director | \n cast | \n country | \n rating | \n listed_in | \n cos_sim | \n
\n \n \n \n 11 | \n 13 Reasons Why: Beyond the Reasons | \n NaN | \n Dylan Minnette, Katherine Langford, Kate Walsh... | \n United States | \n TV-MA | \n Crime TV Shows, Docuseries | \n 0.432789 | \n
\n \n 515 | \n Frequency | \n NaN | \n Peyton List, Riley Smith, Mekhi Phifer, Devin ... | \n United States | \n TV-14 | \n Crime TV Shows, TV Dramas, TV Mysteries | \n 0.381771 | \n
\n \n 1653 | \n The Sinner | \n NaN | \n Jessica Biel, Bill Pullman, Christopher Abbott... | \n United States | \n TV-MA | \n Crime TV Shows, TV Dramas, TV Mysteries | \n 0.362738 | \n
\n \n 964 | \n MINDHUNTER | \n NaN | \n Jonathan Groff, Holt McCallany, Anna Torv, Cot... | \n United States | \n TV-MA | \n Crime TV Shows, TV Dramas, TV Mysteries | \n 0.362738 | \n
\n \n 1775 | \n Unsolved | \n NaN | \n Josh Duhamel, Jimmi Simpson, Bokeem Woodbine | \n United States | \n TV-MA | \n Crime TV Shows, TV Dramas | \n 0.346844 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"recommender('Derry Girls')","execution_count":56,"outputs":[{"output_type":"execute_result","execution_count":56,"data":{"text/plain":" title director \\\n332 Crazyhead NaN \n852 Loaded NaN \n502 Flowers NaN \n180 Big Dreams, Small Spaces NaN \n985 Monty Don's Italian Gardens NaN \n\n cast country rating \\\n332 Cara Theobold, Susan Wokoma, Riann Steele, Ari... United Kingdom TV-MA \n852 Jim Howick, Samuel Anderson, Jonny Sweet, Nick... United Kingdom TV-MA \n502 Olivia Colman, Julian Barratt, Daniel Rigby, S... United Kingdom TV-MA \n180 Monty Don United Kingdom TV-G \n985 Monty Don United Kingdom TV-G \n\n listed_in cos_sim \n332 British TV Shows, International TV Shows, TV C... 0.420084 \n852 British TV Shows, International TV Shows, TV C... 0.403604 \n502 British TV Shows, International TV Shows, TV C... 0.403604 \n180 British TV Shows, International TV Shows, Real... 0.396059 \n985 British TV Shows, Docuseries, International TV... 0.396059 ","text/html":"\n\n
\n \n \n | \n title | \n director | \n cast | \n country | \n rating | \n listed_in | \n cos_sim | \n
\n \n \n \n 332 | \n Crazyhead | \n NaN | \n Cara Theobold, Susan Wokoma, Riann Steele, Ari... | \n United Kingdom | \n TV-MA | \n British TV Shows, International TV Shows, TV C... | \n 0.420084 | \n
\n \n 852 | \n Loaded | \n NaN | \n Jim Howick, Samuel Anderson, Jonny Sweet, Nick... | \n United Kingdom | \n TV-MA | \n British TV Shows, International TV Shows, TV C... | \n 0.403604 | \n
\n \n 502 | \n Flowers | \n NaN | \n Olivia Colman, Julian Barratt, Daniel Rigby, S... | \n United Kingdom | \n TV-MA | \n British TV Shows, International TV Shows, TV C... | \n 0.403604 | \n
\n \n 180 | \n Big Dreams, Small Spaces | \n NaN | \n Monty Don | \n United Kingdom | \n TV-G | \n British TV Shows, International TV Shows, Real... | \n 0.396059 | \n
\n \n 985 | \n Monty Don's Italian Gardens | \n NaN | \n Monty Don | \n United Kingdom | \n TV-G | \n British TV Shows, Docuseries, International TV... | \n 0.396059 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"recommender('Breaking Bad')","execution_count":57,"outputs":[{"output_type":"execute_result","execution_count":57,"data":{"text/plain":" title director \\\n169 Better Call Saul NaN \n1459 The Assassination of Gianni Versace NaN \n1775 Unsolved NaN \n537 Get Shorty NaN \n1416 Surviving R. Kelly NaN \n\n cast country rating \\\n169 Bob Odenkirk, Jonathan Banks, Michael McKean, ... United States TV-MA \n1459 Edgar Ramírez, Darren Criss, Ricky Martin, Pen... United States TV-MA \n1775 Josh Duhamel, Jimmi Simpson, Bokeem Woodbine United States TV-MA \n537 Ray Romano, Chris O'Dowd United States TV-MA \n1416 R. Kelly United States TV-MA \n\n listed_in cos_sim \n169 Crime TV Shows, TV Comedies, TV Dramas 0.521749 \n1459 Crime TV Shows, TV Dramas, TV Thrillers 0.430331 \n1775 Crime TV Shows, TV Dramas 0.390360 \n537 Crime TV Shows, TV Comedies, TV Dramas 0.390360 \n1416 Crime TV Shows, Docuseries 0.346410 ","text/html":"\n\n
\n \n \n | \n title | \n director | \n cast | \n country | \n rating | \n listed_in | \n cos_sim | \n
\n \n \n \n 169 | \n Better Call Saul | \n NaN | \n Bob Odenkirk, Jonathan Banks, Michael McKean, ... | \n United States | \n TV-MA | \n Crime TV Shows, TV Comedies, TV Dramas | \n 0.521749 | \n
\n \n 1459 | \n The Assassination of Gianni Versace | \n NaN | \n Edgar Ramírez, Darren Criss, Ricky Martin, Pen... | \n United States | \n TV-MA | \n Crime TV Shows, TV Dramas, TV Thrillers | \n 0.430331 | \n
\n \n 1775 | \n Unsolved | \n NaN | \n Josh Duhamel, Jimmi Simpson, Bokeem Woodbine | \n United States | \n TV-MA | \n Crime TV Shows, TV Dramas | \n 0.390360 | \n
\n \n 537 | \n Get Shorty | \n NaN | \n Ray Romano, Chris O'Dowd | \n United States | \n TV-MA | \n Crime TV Shows, TV Comedies, TV Dramas | \n 0.390360 | \n
\n \n 1416 | \n Surviving R. Kelly | \n NaN | \n R. Kelly | \n United States | \n TV-MA | \n Crime TV Shows, Docuseries | \n 0.346410 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"recommender('Stranger Things')","execution_count":58,"outputs":[{"output_type":"execute_result","execution_count":58,"data":{"text/plain":" title director \\\n175 Beyond Stranger Things NaN \n1174 Prank Encounters NaN \n625 Helix NaN \n1811 Warrior Nun NaN \n292 Chilling Adventures of Sabrina NaN \n\n cast \\\n175 Jim Rash, Matt Duffer, Ross Duffer, Shawn Levy... \n1174 Gaten Matarazzo \n625 Billy Campbell, Hiroyuki Sanada, Kyra Zagorsky... \n1811 Alba Baptista, Toya Turner, Lorena Andrea, Kri... \n292 Kiernan Shipka, Ross Lynch, Miranda Otto, Lucy... \n\n country rating \\\n175 United States TV-14 \n1174 United States TV-MA \n625 United States, Canada TV-MA \n1811 United States TV-MA \n292 United States TV-14 \n\n listed_in cos_sim \n175 Stand-Up Comedy & Talk Shows, TV Mysteries, TV... 0.741941 \n1174 Reality TV, TV Comedies, TV Horror 0.292770 \n625 TV Horror, TV Mysteries, TV Sci-Fi & Fantasy 0.264628 \n1811 TV Action & Adventure, TV Mysteries, TV Sci-Fi... 0.251976 \n292 TV Horror, TV Mysteries, TV Sci-Fi & Fantasy 0.250313 ","text/html":"\n\n
\n \n \n | \n title | \n director | \n cast | \n country | \n rating | \n listed_in | \n cos_sim | \n
\n \n \n \n 175 | \n Beyond Stranger Things | \n NaN | \n Jim Rash, Matt Duffer, Ross Duffer, Shawn Levy... | \n United States | \n TV-14 | \n Stand-Up Comedy & Talk Shows, TV Mysteries, TV... | \n 0.741941 | \n
\n \n 1174 | \n Prank Encounters | \n NaN | \n Gaten Matarazzo | \n United States | \n TV-MA | \n Reality TV, TV Comedies, TV Horror | \n 0.292770 | \n
\n \n 625 | \n Helix | \n NaN | \n Billy Campbell, Hiroyuki Sanada, Kyra Zagorsky... | \n United States, Canada | \n TV-MA | \n TV Horror, TV Mysteries, TV Sci-Fi & Fantasy | \n 0.264628 | \n
\n \n 1811 | \n Warrior Nun | \n NaN | \n Alba Baptista, Toya Turner, Lorena Andrea, Kri... | \n United States | \n TV-MA | \n TV Action & Adventure, TV Mysteries, TV Sci-Fi... | \n 0.251976 | \n
\n \n 292 | \n Chilling Adventures of Sabrina | \n NaN | \n Kiernan Shipka, Ross Lynch, Miranda Otto, Lucy... | \n United States | \n TV-14 | \n TV Horror, TV Mysteries, TV Sci-Fi & Fantasy | \n 0.250313 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{},"cell_type":"markdown","source":"# 5. Developing Recommendation Engine using *Movie/TV show descriptions*"},{"metadata":{"trusted":true},"cell_type":"code","source":"movies_des = data[data['type'] == 'Movie'].reset_index()\nmovies_des = movies_des[['title', 'description']]\nmovies_des.head()","execution_count":59,"outputs":[{"output_type":"execute_result","execution_count":59,"data":{"text/plain":" title description\n0 7:19 After a devastating earthquake hits Mexico Cit...\n1 23:59 When an army recruit is found dead, his fellow...\n2 9 In a postapocalyptic world, rag-doll robots hi...\n3 21 A brilliant group of students become card-coun...\n4 122 After an awful accident, a couple admitted to ...","text/html":"\n\n
\n \n \n | \n title | \n description | \n
\n \n \n \n 0 | \n 7:19 | \n After a devastating earthquake hits Mexico Cit... | \n
\n \n 1 | \n 23:59 | \n When an army recruit is found dead, his fellow... | \n
\n \n 2 | \n 9 | \n In a postapocalyptic world, rag-doll robots hi... | \n
\n \n 3 | \n 21 | \n A brilliant group of students become card-coun... | \n
\n \n 4 | \n 122 | \n After an awful accident, a couple admitted to ... | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"tv_des = data[data['type'] == 'TV Show'].reset_index()\ntv_des = tv_des[['title', 'description']]\ntv_des.head()","execution_count":60,"outputs":[{"output_type":"execute_result","execution_count":60,"data":{"text/plain":" title \\\n0 3% \n1 46 \n2 1983 \n3 SAINT SEIYA: Knights of the Zodiac \n4 #blackAF \n\n description \n0 In a future where the elite inhabit an island ... \n1 A genetics professor experiments with a treatm... \n2 In this dark alt-history thriller, a naïve law... \n3 Seiya and the Knights of the Zodiac rise again... \n4 Kenya Barris and his family navigate relations... ","text/html":"\n\n
\n \n \n | \n title | \n description | \n
\n \n \n \n 0 | \n 3% | \n In a future where the elite inhabit an island ... | \n
\n \n 1 | \n 46 | \n A genetics professor experiments with a treatm... | \n
\n \n 2 | \n 1983 | \n In this dark alt-history thriller, a naïve law... | \n
\n \n 3 | \n SAINT SEIYA: Knights of the Zodiac | \n Seiya and the Knights of the Zodiac rise again... | \n
\n \n 4 | \n #blackAF | \n Kenya Barris and his family navigate relations... | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"filtered_movies = []\nmovies_words = []\n\nfor text in movies_des['description']:\n text_tokens = word_tokenize(text)\n tokens_without_sw = [word.lower() for word in text_tokens if not word in stopwords.words()]\n movies_words.append(tokens_without_sw)\n filtered = (\" \").join(tokens_without_sw)\n filtered_movies.append(filtered)\n\nmovies_words = [val for sublist in movies_words for val in sublist]\nmovies_words = sorted(set(movies_words))\nmovies_des['description_filtered'] = filtered_movies\nmovies_des.head()","execution_count":61,"outputs":[{"output_type":"execute_result","execution_count":61,"data":{"text/plain":" title description \\\n0 7:19 After a devastating earthquake hits Mexico Cit... \n1 23:59 When an army recruit is found dead, his fellow... \n2 9 In a postapocalyptic world, rag-doll robots hi... \n3 21 A brilliant group of students become card-coun... \n4 122 After an awful accident, a couple admitted to ... \n\n description_filtered \n0 after devastating earthquake hits mexico city ... \n1 when army recruit found dead , fellow soldiers... \n2 in postapocalyptic world , rag-doll robots hid... \n3 a brilliant group students become card-countin... \n4 after awful accident , couple admitted grisly ... ","text/html":"\n\n
\n \n \n | \n title | \n description | \n description_filtered | \n
\n \n \n \n 0 | \n 7:19 | \n After a devastating earthquake hits Mexico Cit... | \n after devastating earthquake hits mexico city ... | \n
\n \n 1 | \n 23:59 | \n When an army recruit is found dead, his fellow... | \n when army recruit found dead , fellow soldiers... | \n
\n \n 2 | \n 9 | \n In a postapocalyptic world, rag-doll robots hi... | \n in postapocalyptic world , rag-doll robots hid... | \n
\n \n 3 | \n 21 | \n A brilliant group of students become card-coun... | \n a brilliant group students become card-countin... | \n
\n \n 4 | \n 122 | \n After an awful accident, a couple admitted to ... | \n after awful accident , couple admitted grisly ... | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"filtered_tv = []\ntv_words = []\n\nfor text in tv_des['description']:\n text_tokens = word_tokenize(text)\n tokens_without_sw = [word.lower() for word in text_tokens if not word in stopwords.words()]\n tv_words.append(tokens_without_sw)\n filtered = (\" \").join(tokens_without_sw)\n filtered_tv.append(filtered)\n\ntv_words = [val for sublist in tv_words for val in sublist]\ntv_words = sorted(set(tv_words))\ntv_des['description_filtered'] = filtered_tv\ntv_des.head()","execution_count":62,"outputs":[{"output_type":"execute_result","execution_count":62,"data":{"text/plain":" title \\\n0 3% \n1 46 \n2 1983 \n3 SAINT SEIYA: Knights of the Zodiac \n4 #blackAF \n\n description \\\n0 In a future where the elite inhabit an island ... \n1 A genetics professor experiments with a treatm... \n2 In this dark alt-history thriller, a naïve law... \n3 Seiya and the Knights of the Zodiac rise again... \n4 Kenya Barris and his family navigate relations... \n\n description_filtered \n0 in future elite inhabit island paradise far cr... \n1 a genetics professor experiments treatment com... \n2 in dark alt-history thriller , naïve law stude... \n3 seiya knights zodiac rise protect reincarnatio... \n4 kenya barris family navigate relationships , r... ","text/html":"\n\n
\n \n \n | \n title | \n description | \n description_filtered | \n
\n \n \n \n 0 | \n 3% | \n In a future where the elite inhabit an island ... | \n in future elite inhabit island paradise far cr... | \n
\n \n 1 | \n 46 | \n A genetics professor experiments with a treatm... | \n a genetics professor experiments treatment com... | \n
\n \n 2 | \n 1983 | \n In this dark alt-history thriller, a naïve law... | \n in dark alt-history thriller , naïve law stude... | \n
\n \n 3 | \n SAINT SEIYA: Knights of the Zodiac | \n Seiya and the Knights of the Zodiac rise again... | \n seiya knights zodiac rise protect reincarnatio... | \n
\n \n 4 | \n #blackAF | \n Kenya Barris and his family navigate relations... | \n kenya barris family navigate relationships , r... | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"movie_word_binary = [[0] * 0 for i in range(len(set(movies_words)))]\n\nfor des in movies_des['description_filtered']:\n k = 0\n for word in movies_words:\n if word in des:\n movie_word_binary[k].append(1.0)\n else:\n movie_word_binary[k].append(0.0)\n k+=1\n \nmovie_word_binary = pd.DataFrame(movie_word_binary).transpose()","execution_count":63,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"tv_word_binary = [[0] * 0 for i in range(len(set(tv_words)))]\n\nfor des in tv_des['description_filtered']:\n k = 0\n for word in tv_words:\n if word in des:\n tv_word_binary[k].append(1.0)\n else:\n tv_word_binary[k].append(0.0)\n k+=1\n \ntv_word_binary = pd.DataFrame(tv_word_binary).transpose()","execution_count":64,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"def recommender2(search):\n cs_list = []\n binary_list = []\n if search in movies_des['title'].values:\n idx = movies_des[movies_des['title'] == search].index.item()\n for i in movie_word_binary.iloc[idx]:\n binary_list.append(i)\n point1 = np.array(binary_list).reshape(1, -1)\n point1 = [val for sublist in point1 for val in sublist] \n for j in range(len(movies_des)):\n binary_list2 = []\n for k in movie_word_binary.iloc[j]:\n binary_list2.append(k)\n point2 = np.array(binary_list2).reshape(1, -1)\n point2 = [val for sublist in point2 for val in sublist]\n dot_product = np.dot(point1, point2)\n norm_1 = np.linalg.norm(point1)\n norm_2 = np.linalg.norm(point2)\n cos_sim = dot_product / (norm_1 * norm_2)\n cs_list.append(cos_sim)\n movies_copy = movies_des.copy()\n movies_copy['cos_sim'] = cs_list\n results = movies_copy.sort_values('cos_sim', ascending=False)\n results = results[results['title'] != search] \n top_results = results.head(5)\n return(top_results)\n elif search in tv_des['title'].values:\n idx = tv_des[tv_des['title'] == search].index.item()\n for i in tv_word_binary.iloc[idx]:\n binary_list.append(i)\n point1 = np.array(binary_list).reshape(1, -1)\n point1 = [val for sublist in point1 for val in sublist]\n for j in range(len(tv)):\n binary_list2 = []\n for k in tv_word_binary.iloc[j]:\n binary_list2.append(k)\n point2 = np.array(binary_list2).reshape(1, -1)\n point2 = [val for sublist in point2 for val in sublist]\n dot_product = np.dot(point1, point2)\n norm_1 = np.linalg.norm(point1)\n norm_2 = np.linalg.norm(point2)\n cos_sim = dot_product / (norm_1 * norm_2)\n cs_list.append(cos_sim)\n tv_copy = tv_des.copy()\n tv_copy['cos_sim'] = cs_list\n results = tv_copy.sort_values('cos_sim', ascending=False)\n results = results[results['title'] != search] \n top_results = results.head(5)\n return(top_results)\n else:\n return(\"Title not in dataset. Please check spelling.\")","execution_count":65,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"## 5.1. Recommending Movies"},{"metadata":{"trusted":true},"cell_type":"code","source":"pd.options.display.max_colwidth = 300\nrecommender2('The Conjuring')","execution_count":66,"outputs":[{"output_type":"execute_result","execution_count":66,"data":{"text/plain":" title \\\n1632 Hard Lessons \n3335 Sat Sri Akal \n2549 Mirai \n3910 The Eyes of My Mother \n3578 Standoff \n\n description \\\n1632 This drama based on real-life events tells the story of George McKenna, the tough, determined new principal of a notorious Los Angeles high school. \n3335 Based on true events, this moving story centers on a Punjabi family whose celebration of their faith endures in the face of conflicting attitudes. \n2549 Unhappy after his new baby sister displaces him, four-year-old Kun begins meeting people and pets from his family's history in their unique house. \n3910 At the remote farmhouse where she once witnessed a traumatic childhood event, a young woman develops a grisly fascination with violence. \n3578 After witnessing an assassin's slaughter, a young girl holes up in a farmhouse with a suicidal vet, who must use wits and guts to fend off the killer. \n\n description_filtered \\\n1632 this drama based real-life events tells story george mckenna , tough , determined new principal notorious los angeles high school . \n3335 based true events , moving story centers punjabi family whose celebration faith endures conflicting attitudes . \n2549 unhappy new baby sister displaces , four-year-old kun begins meeting people pets family 's history unique house . \n3910 at remote farmhouse witnessed traumatic childhood event , young woman develops grisly fascination violence . \n3578 after witnessing assassin 's slaughter , young girl holes farmhouse suicidal vet , must use wits guts fend killer . \n\n cos_sim \n1632 0.489419 \n3335 0.478650 \n2549 0.478345 \n3910 0.470605 \n3578 0.460628 ","text/html":"\n\n
\n \n \n | \n title | \n description | \n description_filtered | \n cos_sim | \n
\n \n \n \n 1632 | \n Hard Lessons | \n This drama based on real-life events tells the story of George McKenna, the tough, determined new principal of a notorious Los Angeles high school. | \n this drama based real-life events tells story george mckenna , tough , determined new principal notorious los angeles high school . | \n 0.489419 | \n
\n \n 3335 | \n Sat Sri Akal | \n Based on true events, this moving story centers on a Punjabi family whose celebration of their faith endures in the face of conflicting attitudes. | \n based true events , moving story centers punjabi family whose celebration faith endures conflicting attitudes . | \n 0.478650 | \n
\n \n 2549 | \n Mirai | \n Unhappy after his new baby sister displaces him, four-year-old Kun begins meeting people and pets from his family's history in their unique house. | \n unhappy new baby sister displaces , four-year-old kun begins meeting people pets family 's history unique house . | \n 0.478345 | \n
\n \n 3910 | \n The Eyes of My Mother | \n At the remote farmhouse where she once witnessed a traumatic childhood event, a young woman develops a grisly fascination with violence. | \n at remote farmhouse witnessed traumatic childhood event , young woman develops grisly fascination violence . | \n 0.470605 | \n
\n \n 3578 | \n Standoff | \n After witnessing an assassin's slaughter, a young girl holes up in a farmhouse with a suicidal vet, who must use wits and guts to fend off the killer. | \n after witnessing assassin 's slaughter , young girl holes farmhouse suicidal vet , must use wits guts fend killer . | \n 0.460628 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"recommender2(\"Child's Play\")","execution_count":67,"outputs":[{"output_type":"execute_result","execution_count":67,"data":{"text/plain":" title \\\n2467 Material \n3605 Strange Weather \n3553 Spectral \n1550 Good People \n1017 Dark Places \n\n description \\\n2467 A dutiful son must hide his pursuit of stand-up comedy from his staunch father, who expects him to inherit his store and uphold their Muslim beliefs. \n3605 A grieving mother takes a road trip with her friend to confront the man who, she believes, stole her late son's business idea to get rich. \n3553 When an otherworldly force wreaks havoc on a war-torn European city, an engineer teams up with an elite Special Ops unit to stop it. \n1550 A struggling couple can't believe their luck when they find a stash of money in the apartment of a neighbor who was recently murdered. \n1017 Years after surviving a brutal crime as a child, Libby Day comes to believe that the brother she testified against for committing it may be innocent. \n\n description_filtered \\\n2467 a dutiful must hide pursuit stand-up comedy staunch father , expects inherit store uphold muslim beliefs . \n3605 a grieving mother takes road trip friend confront , believes , stole late 's business idea get rich . \n3553 when otherworldly force wreaks havoc war-torn european city , engineer teams elite special ops unit stop . \n1550 a struggling couple n't believe luck find stash money apartment neighbor recently murdered . \n1017 years surviving brutal crime child , libby day comes believe brother testified committing may innocent . \n\n cos_sim \n2467 0.431291 \n3605 0.420183 \n3553 0.414039 \n1550 0.411766 \n1017 0.410391 ","text/html":"\n\n
\n \n \n | \n title | \n description | \n description_filtered | \n cos_sim | \n
\n \n \n \n 2467 | \n Material | \n A dutiful son must hide his pursuit of stand-up comedy from his staunch father, who expects him to inherit his store and uphold their Muslim beliefs. | \n a dutiful must hide pursuit stand-up comedy staunch father , expects inherit store uphold muslim beliefs . | \n 0.431291 | \n
\n \n 3605 | \n Strange Weather | \n A grieving mother takes a road trip with her friend to confront the man who, she believes, stole her late son's business idea to get rich. | \n a grieving mother takes road trip friend confront , believes , stole late 's business idea get rich . | \n 0.420183 | \n
\n \n 3553 | \n Spectral | \n When an otherworldly force wreaks havoc on a war-torn European city, an engineer teams up with an elite Special Ops unit to stop it. | \n when otherworldly force wreaks havoc war-torn european city , engineer teams elite special ops unit stop . | \n 0.414039 | \n
\n \n 1550 | \n Good People | \n A struggling couple can't believe their luck when they find a stash of money in the apartment of a neighbor who was recently murdered. | \n a struggling couple n't believe luck find stash money apartment neighbor recently murdered . | \n 0.411766 | \n
\n \n 1017 | \n Dark Places | \n Years after surviving a brutal crime as a child, Libby Day comes to believe that the brother she testified against for committing it may be innocent. | \n years surviving brutal crime child , libby day comes believe brother testified committing may innocent . | \n 0.410391 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"recommender2('Charlie and the Chocolate Factory')","execution_count":68,"outputs":[{"output_type":"execute_result","execution_count":68,"data":{"text/plain":" title \\\n4671 Willy Wonka & the Chocolate Factory \n2040 Kaake Da Viyah \n3796 The Boss's Daughter \n4306 The Wishing Tree \n1884 Inxeba \n\n description \\\n4671 Zany Willy Wonka causes a stir when he announces that golden tickets hidden inside his candy bars will admit holders into his secret confectionary. \n2040 In this zany comedy, a man is torn between the girl he loves and the respective women his warring mother and grandmother have chosen for him to marry. \n3796 While working together, a married textile foreman and his boss’s daughter have a torrid love affair, stirring up hostility among the factory crew. \n4306 Five children living on the edge of a forest band together to save a magical wishing tree from destruction and find their own paths to happiness. \n1884 At an initiation ritual for the young men of his Xhosa community, a closeted factory hand meets a Johannesburg teen who discovers his best-kept secret. \n\n description_filtered \\\n4671 zany willy wonka causes stir announces golden tickets hidden inside candy bars admit holders secret confectionary . \n2040 in zany comedy , torn girl loves respective women warring mother grandmother chosen marry . \n3796 while working together , married textile foreman boss ’ daughter torrid love affair , stirring hostility among factory crew . \n4306 five children living edge forest band together save magical wishing tree destruction find paths happiness . \n1884 at initiation ritual young xhosa community , closeted factory hand meets johannesburg teen discovers best-kept secret . \n\n cos_sim \n4671 0.400892 \n2040 0.383326 \n3796 0.381000 \n4306 0.368856 \n1884 0.363803 ","text/html":"\n\n
\n \n \n | \n title | \n description | \n description_filtered | \n cos_sim | \n
\n \n \n \n 4671 | \n Willy Wonka & the Chocolate Factory | \n Zany Willy Wonka causes a stir when he announces that golden tickets hidden inside his candy bars will admit holders into his secret confectionary. | \n zany willy wonka causes stir announces golden tickets hidden inside candy bars admit holders secret confectionary . | \n 0.400892 | \n
\n \n 2040 | \n Kaake Da Viyah | \n In this zany comedy, a man is torn between the girl he loves and the respective women his warring mother and grandmother have chosen for him to marry. | \n in zany comedy , torn girl loves respective women warring mother grandmother chosen marry . | \n 0.383326 | \n
\n \n 3796 | \n The Boss's Daughter | \n While working together, a married textile foreman and his boss’s daughter have a torrid love affair, stirring up hostility among the factory crew. | \n while working together , married textile foreman boss ’ daughter torrid love affair , stirring hostility among factory crew . | \n 0.381000 | \n
\n \n 4306 | \n The Wishing Tree | \n Five children living on the edge of a forest band together to save a magical wishing tree from destruction and find their own paths to happiness. | \n five children living edge forest band together save magical wishing tree destruction find paths happiness . | \n 0.368856 | \n
\n \n 1884 | \n Inxeba | \n At an initiation ritual for the young men of his Xhosa community, a closeted factory hand meets a Johannesburg teen who discovers his best-kept secret. | \n at initiation ritual young xhosa community , closeted factory hand meets johannesburg teen discovers best-kept secret . | \n 0.363803 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"recommender2('Wild Child')","execution_count":69,"outputs":[{"output_type":"execute_result","execution_count":69,"data":{"text/plain":" title \\\n1319 Fanatyk \n1217 Either Me Or My Auntie \n2694 My Own Man \n2554 Misfit \n1288 Evvarikee Cheppoddu \n\n description \\\n1319 As a son deals with his own struggles, he must calm his father's obsession with fishing before his outlandish behavior ruins the entire family. \n1217 A musician's marriage proposal to his girlfriend is denied by her mother, whose affinity for magic begins to meddle in their relationship even more. \n2694 When a man discovers he will be the father to a boy, his fear and insecurities send him on an emotional, humorous quest for his own manhood. \n2554 After living in America for years, a teenage girl moves back to the Netherlands and is quickly singled out as a misfit by the popular clique at school. \n1288 When caste differences throw a wrench into their otherwise blossoming relationship, a couple must somehow convince the girl’s father to let them marry. \n\n description_filtered \\\n1319 as deals struggles , must calm father 's obsession fishing outlandish behavior ruins entire family . \n1217 a musician 's marriage proposal girlfriend denied mother , whose affinity magic begins meddle relationship even . \n2694 when discovers father boy , fear insecurities send emotional , humorous quest manhood . \n2554 after living america years , teenage girl moves back netherlands quickly singled misfit popular clique school . \n1288 when caste differences throw wrench otherwise blossoming relationship , couple must somehow convince girl ’ father let marry . \n\n cos_sim \n1319 0.497940 \n1217 0.468979 \n2694 0.453565 \n2554 0.448014 \n1288 0.446630 ","text/html":"\n\n
\n \n \n | \n title | \n description | \n description_filtered | \n cos_sim | \n
\n \n \n \n 1319 | \n Fanatyk | \n As a son deals with his own struggles, he must calm his father's obsession with fishing before his outlandish behavior ruins the entire family. | \n as deals struggles , must calm father 's obsession fishing outlandish behavior ruins entire family . | \n 0.497940 | \n
\n \n 1217 | \n Either Me Or My Auntie | \n A musician's marriage proposal to his girlfriend is denied by her mother, whose affinity for magic begins to meddle in their relationship even more. | \n a musician 's marriage proposal girlfriend denied mother , whose affinity magic begins meddle relationship even . | \n 0.468979 | \n
\n \n 2694 | \n My Own Man | \n When a man discovers he will be the father to a boy, his fear and insecurities send him on an emotional, humorous quest for his own manhood. | \n when discovers father boy , fear insecurities send emotional , humorous quest manhood . | \n 0.453565 | \n
\n \n 2554 | \n Misfit | \n After living in America for years, a teenage girl moves back to the Netherlands and is quickly singled out as a misfit by the popular clique at school. | \n after living america years , teenage girl moves back netherlands quickly singled misfit popular clique school . | \n 0.448014 | \n
\n \n 1288 | \n Evvarikee Cheppoddu | \n When caste differences throw a wrench into their otherwise blossoming relationship, a couple must somehow convince the girl’s father to let them marry. | \n when caste differences throw wrench otherwise blossoming relationship , couple must somehow convince girl ’ father let marry . | \n 0.446630 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"recommender2(\"Dr. Seuss' The Cat in the Hat\")","execution_count":70,"outputs":[{"output_type":"execute_result","execution_count":70,"data":{"text/plain":" title \\\n1660 He's Out There \n1016 Dark Light \n1853 INDIA \n3808 The Breadwinner \n1217 Either Me Or My Auntie \n\n description \\\n1660 While vacationing at a remote lake house, a mother and her daughters become pawns in the twisted game of an ax-wielding psychopath. \n1016 Implicated in her daughter's disappearance, a mother searches for answers when she returns to an old family home that may have an unwanted visitor. \n1853 A man buys a young girl, code-names her \"Doll\" and sends her to live with a mother of two who has a mysterious mission to be fulfilled. \n3808 A courageous 11-year-old Afghan girl disguises herself as a boy and takes on odd jobs to provide for her family when her father is arrested. \n1217 A musician's marriage proposal to his girlfriend is denied by her mother, whose affinity for magic begins to meddle in their relationship even more. \n\n description_filtered \\\n1660 while vacationing remote lake house , mother daughters become pawns twisted game ax-wielding psychopath . \n1016 implicated daughter 's disappearance , mother searches answers returns old family home may unwanted visitor . \n1853 a buys young girl , code-names `` doll '' sends live mother two mysterious mission fulfilled . \n3808 a courageous 11-year-old afghan girl disguises boy takes odd jobs provide family father arrested . \n1217 a musician 's marriage proposal girlfriend denied mother , whose affinity magic begins meddle relationship even . \n\n cos_sim \n1660 0.486506 \n1016 0.483046 \n1853 0.460195 \n3808 0.454621 \n1217 0.444117 ","text/html":"\n\n
\n \n \n | \n title | \n description | \n description_filtered | \n cos_sim | \n
\n \n \n \n 1660 | \n He's Out There | \n While vacationing at a remote lake house, a mother and her daughters become pawns in the twisted game of an ax-wielding psychopath. | \n while vacationing remote lake house , mother daughters become pawns twisted game ax-wielding psychopath . | \n 0.486506 | \n
\n \n 1016 | \n Dark Light | \n Implicated in her daughter's disappearance, a mother searches for answers when she returns to an old family home that may have an unwanted visitor. | \n implicated daughter 's disappearance , mother searches answers returns old family home may unwanted visitor . | \n 0.483046 | \n
\n \n 1853 | \n INDIA | \n A man buys a young girl, code-names her \"Doll\" and sends her to live with a mother of two who has a mysterious mission to be fulfilled. | \n a buys young girl , code-names `` doll '' sends live mother two mysterious mission fulfilled . | \n 0.460195 | \n
\n \n 3808 | \n The Breadwinner | \n A courageous 11-year-old Afghan girl disguises herself as a boy and takes on odd jobs to provide for her family when her father is arrested. | \n a courageous 11-year-old afghan girl disguises boy takes odd jobs provide family father arrested . | \n 0.454621 | \n
\n \n 1217 | \n Either Me Or My Auntie | \n A musician's marriage proposal to his girlfriend is denied by her mother, whose affinity for magic begins to meddle in their relationship even more. | \n a musician 's marriage proposal girlfriend denied mother , whose affinity magic begins meddle relationship even . | \n 0.444117 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"recommender2('Hook')","execution_count":71,"outputs":[{"output_type":"execute_result","execution_count":71,"data":{"text/plain":" title \\\n4371 Tinker Bell and the Legend of the NeverBeast \n2113 Kickboxer: Retaliation \n1740 Hostiles \n1515 Girlfriend's Day \n2804 NOVA: Decoding the Weather Machine \n\n description \\\n4371 When suspicious scout fairies scheme to capture the fearsome-looking NeverBeast, Tinker Bell and Fawn set out to save the wondrous creature. \n2113 Sloan's vow to never return to Thailand is cut short when he's kidnapped and taken to a Thai prison, where he's forced to fight a 400-pound brute. \n1740 After a long career battling the Cheyenne, a U.S. Army captain is ordered to safely escort the tribe's most influential chief to his Montana homeland. \n1515 When he's caught up in a deadly conspiracy, an unemployed greeting card writer must create the perfect card for a new holiday to save his skin. \n2804 Scientists investigate Earth’s climate machine, looking for clues across the globe, from Greenland’s ice sheet to the desert of Australia. \n\n description_filtered \\\n4371 when suspicious scout fairies scheme capture fearsome-looking neverbeast , tinker bell fawn set save wondrous creature . \n2113 sloan 's vow never return thailand cut short 's kidnapped taken thai prison , 's forced fight 400-pound brute . \n1740 after long career battling cheyenne , u.s. army captain ordered safely escort tribe 's influential chief montana homeland . \n1515 when 's caught deadly conspiracy , unemployed greeting card writer must create perfect card new holiday save skin . \n2804 scientists investigate earth ’ climate machine , looking clues across globe , greenland ’ ice sheet desert australia . \n\n cos_sim \n4371 0.425195 \n2113 0.418167 \n1740 0.415629 \n1515 0.415168 \n2804 0.414781 ","text/html":"\n\n
\n \n \n | \n title | \n description | \n description_filtered | \n cos_sim | \n
\n \n \n \n 4371 | \n Tinker Bell and the Legend of the NeverBeast | \n When suspicious scout fairies scheme to capture the fearsome-looking NeverBeast, Tinker Bell and Fawn set out to save the wondrous creature. | \n when suspicious scout fairies scheme capture fearsome-looking neverbeast , tinker bell fawn set save wondrous creature . | \n 0.425195 | \n
\n \n 2113 | \n Kickboxer: Retaliation | \n Sloan's vow to never return to Thailand is cut short when he's kidnapped and taken to a Thai prison, where he's forced to fight a 400-pound brute. | \n sloan 's vow never return thailand cut short 's kidnapped taken thai prison , 's forced fight 400-pound brute . | \n 0.418167 | \n
\n \n 1740 | \n Hostiles | \n After a long career battling the Cheyenne, a U.S. Army captain is ordered to safely escort the tribe's most influential chief to his Montana homeland. | \n after long career battling cheyenne , u.s. army captain ordered safely escort tribe 's influential chief montana homeland . | \n 0.415629 | \n
\n \n 1515 | \n Girlfriend's Day | \n When he's caught up in a deadly conspiracy, an unemployed greeting card writer must create the perfect card for a new holiday to save his skin. | \n when 's caught deadly conspiracy , unemployed greeting card writer must create perfect card new holiday save skin . | \n 0.415168 | \n
\n \n 2804 | \n NOVA: Decoding the Weather Machine | \n Scientists investigate Earth’s climate machine, looking for clues across the globe, from Greenland’s ice sheet to the desert of Australia. | \n scientists investigate earth ’ climate machine , looking clues across globe , greenland ’ ice sheet desert australia . | \n 0.414781 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"recommender2('Holidate')","execution_count":72,"outputs":[{"output_type":"execute_result","execution_count":72,"data":{"text/plain":" title \\\n4707 Yanda Kartavya Aahe \n3165 Red Christmas \n4527 Us and Them \n286 All of You \n3963 The Hateful Eight \n\n description \\\n4707 Thanks to an arranged marriage that was designed to make an ailing grandmother happy, newlyweds Rahul and Swati are virtually strangers. Can a four-day honeymoon make a difference when it comes to the couple's feelings about each other? \n3165 A family Christmas gathering at an isolated Australian estate turns into the holiday from hell after a mysterious stranger turns up at the door. \n4527 Two strangers meet on a train and form a bond that evolves over the years. After a separation, they reconnect and reflect on their love for each other. \n286 Two strangers meet on a dating app and experience instant chemistry, but their relationship unravels as jarring differences catch up to them. \n3963 Years after the Civil War, a bounty hunter and his captive are waylaid by a Wyoming blizzard and hole up in a way station with six dicey strangers. \n\n description_filtered \\\n4707 thanks arranged marriage designed make ailing grandmother happy , newlyweds rahul swati virtually strangers . can four-day honeymoon make difference comes couple 's feelings ? \n3165 a family christmas gathering isolated australian estate turns holiday hell mysterious stranger turns . \n4527 two strangers meet train form bond evolves years . after separation , reconnect reflect love . \n286 two strangers meet dating app experience instant chemistry , relationship unravels jarring differences catch . \n3963 years civil war , bounty hunter captive waylaid wyoming blizzard hole way station six dicey strangers . \n\n cos_sim \n4707 0.449089 \n3165 0.446663 \n4527 0.445435 \n286 0.439155 \n3963 0.439155 ","text/html":"\n\n
\n \n \n | \n title | \n description | \n description_filtered | \n cos_sim | \n
\n \n \n \n 4707 | \n Yanda Kartavya Aahe | \n Thanks to an arranged marriage that was designed to make an ailing grandmother happy, newlyweds Rahul and Swati are virtually strangers. Can a four-day honeymoon make a difference when it comes to the couple's feelings about each other? | \n thanks arranged marriage designed make ailing grandmother happy , newlyweds rahul swati virtually strangers . can four-day honeymoon make difference comes couple 's feelings ? | \n 0.449089 | \n
\n \n 3165 | \n Red Christmas | \n A family Christmas gathering at an isolated Australian estate turns into the holiday from hell after a mysterious stranger turns up at the door. | \n a family christmas gathering isolated australian estate turns holiday hell mysterious stranger turns . | \n 0.446663 | \n
\n \n 4527 | \n Us and Them | \n Two strangers meet on a train and form a bond that evolves over the years. After a separation, they reconnect and reflect on their love for each other. | \n two strangers meet train form bond evolves years . after separation , reconnect reflect love . | \n 0.445435 | \n
\n \n 286 | \n All of You | \n Two strangers meet on a dating app and experience instant chemistry, but their relationship unravels as jarring differences catch up to them. | \n two strangers meet dating app experience instant chemistry , relationship unravels jarring differences catch . | \n 0.439155 | \n
\n \n 3963 | \n The Hateful Eight | \n Years after the Civil War, a bounty hunter and his captive are waylaid by a Wyoming blizzard and hole up in a way station with six dicey strangers. | \n years civil war , bounty hunter captive waylaid wyoming blizzard hole way station six dicey strangers . | \n 0.439155 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{},"cell_type":"markdown","source":"## 5.2. Recommending TV shows"},{"metadata":{"trusted":true},"cell_type":"code","source":"recommender2('After Life')","execution_count":73,"outputs":[{"output_type":"execute_result","execution_count":73,"data":{"text/plain":" title \\\n1628 The Paper \n1821 Welcome to the Family \n534 Gentlemen and Gangsters \n1848 Winter Sun \n858 Longmire \n\n description \\\n1628 A construction magnate takes over a struggling newspaper and attempts to wield editorial influence for power and personal gain. \n1821 When an evicted single mom's estranged father dies, she and his second wife cover up his death after learning they've been written out of his will. \n534 Now on the run, a writer relates his previous year's escapades when he got sucked into the thrilling, sordid orbit of boxer and jazz man Henry Morgan. \n1848 Years after ruthless businessmen kill his father and order the death of his twin brother, a modest fisherman adopts a new persona to exact revenge. \n858 This contemporary crime thriller focuses on a Wyoming sheriff who's rebuilding his life and career following the death of his wife. \n\n description_filtered \\\n1628 a construction magnate takes struggling newspaper attempts wield editorial influence power personal gain . \n1821 when evicted single mom 's estranged father , second wife cover death learning 've written . \n534 now run , writer relates previous year 's escapades got sucked thrilling , sordid orbit boxer jazz henry morgan . \n1848 years ruthless businessmen kill father order death twin brother , modest fisherman adopts new persona exact revenge . \n858 this contemporary crime thriller focuses wyoming sheriff 's rebuilding life career following death wife . \n\n cos_sim \n1628 0.483546 \n1821 0.455016 \n534 0.437880 \n1848 0.437384 \n858 0.425307 ","text/html":"\n\n
\n \n \n | \n title | \n description | \n description_filtered | \n cos_sim | \n
\n \n \n \n 1628 | \n The Paper | \n A construction magnate takes over a struggling newspaper and attempts to wield editorial influence for power and personal gain. | \n a construction magnate takes struggling newspaper attempts wield editorial influence power personal gain . | \n 0.483546 | \n
\n \n 1821 | \n Welcome to the Family | \n When an evicted single mom's estranged father dies, she and his second wife cover up his death after learning they've been written out of his will. | \n when evicted single mom 's estranged father , second wife cover death learning 've written . | \n 0.455016 | \n
\n \n 534 | \n Gentlemen and Gangsters | \n Now on the run, a writer relates his previous year's escapades when he got sucked into the thrilling, sordid orbit of boxer and jazz man Henry Morgan. | \n now run , writer relates previous year 's escapades got sucked thrilling , sordid orbit boxer jazz henry morgan . | \n 0.437880 | \n
\n \n 1848 | \n Winter Sun | \n Years after ruthless businessmen kill his father and order the death of his twin brother, a modest fisherman adopts a new persona to exact revenge. | \n years ruthless businessmen kill father order death twin brother , modest fisherman adopts new persona exact revenge . | \n 0.437384 | \n
\n \n 858 | \n Longmire | \n This contemporary crime thriller focuses on a Wyoming sheriff who's rebuilding his life and career following the death of his wife. | \n this contemporary crime thriller focuses wyoming sheriff 's rebuilding life career following death wife . | \n 0.425307 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"recommender2('Anne with an E')","execution_count":74,"outputs":[{"output_type":"execute_result","execution_count":74,"data":{"text/plain":" title \\\n764 Khaani \n348 Dad's Army \n147 Bat Pat \n519 From Dusk Till Dawn \n370 DC's Legends of Tomorrow \n\n description \\\n764 After a rich politician's son kills a young woman's brother, an unlikely romantic connection complicates her pursuit of justice. \n348 This beloved sitcom follows the unlikely heroes of the volunteer British Home Guard as they prepare for German invasion in World War II. \n147 A curious and talkative bat finds spooky fun on the streets of Fogville, a town that's not as quiet as it seems, with a plucky girl and her brothers. \n519 Bank-robbing brothers encounter vengeful lawmen and demons south of the border in this original series based on Robert Rodriguez' cult horror film. \n370 A mysterious \"time master\" from the future unites an unlikely group of superheroes and villains to save the world from a powerful evil. \n\n description_filtered \\\n764 after rich politician 's kills young woman 's brother , unlikely romantic connection complicates pursuit justice . \n348 this beloved sitcom follows unlikely heroes volunteer british home guard prepare german invasion world war ii . \n147 a curious talkative bat finds spooky fun streets fogville , town 's quiet seems , plucky girl brothers . \n519 bank-robbing brothers encounter vengeful lawmen demons south border original series based robert rodriguez ' cult horror film . \n370 a mysterious `` time master '' future unites unlikely group superheroes villains save world powerful evil . \n\n cos_sim \n764 0.410112 \n348 0.405726 \n147 0.397360 \n519 0.392920 \n370 0.389490 ","text/html":"\n\n
\n \n \n | \n title | \n description | \n description_filtered | \n cos_sim | \n
\n \n \n \n 764 | \n Khaani | \n After a rich politician's son kills a young woman's brother, an unlikely romantic connection complicates her pursuit of justice. | \n after rich politician 's kills young woman 's brother , unlikely romantic connection complicates pursuit justice . | \n 0.410112 | \n
\n \n 348 | \n Dad's Army | \n This beloved sitcom follows the unlikely heroes of the volunteer British Home Guard as they prepare for German invasion in World War II. | \n this beloved sitcom follows unlikely heroes volunteer british home guard prepare german invasion world war ii . | \n 0.405726 | \n
\n \n 147 | \n Bat Pat | \n A curious and talkative bat finds spooky fun on the streets of Fogville, a town that's not as quiet as it seems, with a plucky girl and her brothers. | \n a curious talkative bat finds spooky fun streets fogville , town 's quiet seems , plucky girl brothers . | \n 0.397360 | \n
\n \n 519 | \n From Dusk Till Dawn | \n Bank-robbing brothers encounter vengeful lawmen and demons south of the border in this original series based on Robert Rodriguez' cult horror film. | \n bank-robbing brothers encounter vengeful lawmen demons south border original series based robert rodriguez ' cult horror film . | \n 0.392920 | \n
\n \n 370 | \n DC's Legends of Tomorrow | \n A mysterious \"time master\" from the future unites an unlikely group of superheroes and villains to save the world from a powerful evil. | \n a mysterious `` time master '' future unites unlikely group superheroes villains save world powerful evil . | \n 0.389490 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"recommender2('Gilmore Girls')","execution_count":75,"outputs":[{"output_type":"execute_result","execution_count":75,"data":{"text/plain":" title \\\n1871 YooHoo to the Rescue \n816 Legacies \n1290 Seis Manos \n1510 The Duchess \n887 Luis Miguel - The Series \n\n description \\\n1871 In a series of magical missions, quick-witted YooHoo and his can-do crew travel the globe to help animals in need. \n816 Born into a rare supernatural bloodline, Hope Mikaelson attends a gifted private school to master her powers and control her innate urges for evil. \n1290 Orphans raised by a martial arts master are plunged into a mystery involving demonic powers, drug cartels, ancient rituals and blood sacrifice. \n1510 Katherine's a single mom juggling her career, her tween daughter, her relationship with her boyfriend — and pondering getting pregnant with her ex. \n887 This series dramatizes the life story of Mexican superstar singer Luis Miguel, who has captivated audiences in Latin America and beyond for decades. \n\n description_filtered \\\n1871 in series magical missions , quick-witted yoohoo can-do crew travel globe help animals need . \n816 born rare supernatural bloodline , hope mikaelson attends gifted private school master powers control innate urges evil . \n1290 orphans raised martial arts master plunged mystery involving demonic powers , cartels , ancient rituals blood sacrifice . \n1510 katherine 's single mom juggling career , tween daughter , relationship boyfriend — pondering getting pregnant ex . \n887 this series dramatizes life story mexican superstar singer luis miguel , captivated audiences latin america beyond decades . \n\n cos_sim \n1871 0.419640 \n816 0.392232 \n1290 0.387836 \n1510 0.376256 \n887 0.376256 ","text/html":"\n\n
\n \n \n | \n title | \n description | \n description_filtered | \n cos_sim | \n
\n \n \n \n 1871 | \n YooHoo to the Rescue | \n In a series of magical missions, quick-witted YooHoo and his can-do crew travel the globe to help animals in need. | \n in series magical missions , quick-witted yoohoo can-do crew travel globe help animals need . | \n 0.419640 | \n
\n \n 816 | \n Legacies | \n Born into a rare supernatural bloodline, Hope Mikaelson attends a gifted private school to master her powers and control her innate urges for evil. | \n born rare supernatural bloodline , hope mikaelson attends gifted private school master powers control innate urges evil . | \n 0.392232 | \n
\n \n 1290 | \n Seis Manos | \n Orphans raised by a martial arts master are plunged into a mystery involving demonic powers, drug cartels, ancient rituals and blood sacrifice. | \n orphans raised martial arts master plunged mystery involving demonic powers , cartels , ancient rituals blood sacrifice . | \n 0.387836 | \n
\n \n 1510 | \n The Duchess | \n Katherine's a single mom juggling her career, her tween daughter, her relationship with her boyfriend — and pondering getting pregnant with her ex. | \n katherine 's single mom juggling career , tween daughter , relationship boyfriend — pondering getting pregnant ex . | \n 0.376256 | \n
\n \n 887 | \n Luis Miguel - The Series | \n This series dramatizes the life story of Mexican superstar singer Luis Miguel, who has captivated audiences in Latin America and beyond for decades. | \n this series dramatizes life story mexican superstar singer luis miguel , captivated audiences latin america beyond decades . | \n 0.376256 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"recommender2('Friends')","execution_count":76,"outputs":[{"output_type":"execute_result","execution_count":76,"data":{"text/plain":" title \\\n1700 Thomas and Friends \n211 Bondi Rescue \n593 H \n1266 Saint Seiya: The Lost Canvas \n131 Bad Blood \n\n description \\\n1700 This animated children's series follows the adventures of Thomas, a cheerful blue tank engine who lives on the island of Sodor. \n211 This reality series follows elite professional lifeguards on Sydney's Bondi Beach, as they take on everything from animal stings to criminals. \n593 At a dysfunctional hospital in Paris, three bumbling, eccentric medical employees embark on zany misadventures with surgical imprecision. \n1266 This anime adventure follows the battle between a saint of Athena and an avatar of Hades who's working on a painting that could destroy the world. \n131 This sprawling crime drama follows the true story of the Rizzuto family and its associates, who presided over organized crime in Montreal for decades. \n\n description_filtered \\\n1700 this animated children 's series follows adventures thomas , cheerful blue tank engine lives island sodor . \n211 this reality series follows elite professional lifeguards sydney 's bondi beach , everything animal stings criminals . \n593 at dysfunctional hospital paris , three bumbling , eccentric medical employees embark zany misadventures surgical imprecision . \n1266 this anime adventure follows battle saint athena avatar hades 's working painting could destroy world . \n131 this sprawling crime drama follows true story rizzuto family associates , presided organized crime montreal decades . \n\n cos_sim \n1700 0.419292 \n211 0.403376 \n593 0.403101 \n1266 0.401772 \n131 0.398790 ","text/html":"\n\n
\n \n \n | \n title | \n description | \n description_filtered | \n cos_sim | \n
\n \n \n \n 1700 | \n Thomas and Friends | \n This animated children's series follows the adventures of Thomas, a cheerful blue tank engine who lives on the island of Sodor. | \n this animated children 's series follows adventures thomas , cheerful blue tank engine lives island sodor . | \n 0.419292 | \n
\n \n 211 | \n Bondi Rescue | \n This reality series follows elite professional lifeguards on Sydney's Bondi Beach, as they take on everything from animal stings to criminals. | \n this reality series follows elite professional lifeguards sydney 's bondi beach , everything animal stings criminals . | \n 0.403376 | \n
\n \n 593 | \n H | \n At a dysfunctional hospital in Paris, three bumbling, eccentric medical employees embark on zany misadventures with surgical imprecision. | \n at dysfunctional hospital paris , three bumbling , eccentric medical employees embark zany misadventures surgical imprecision . | \n 0.403101 | \n
\n \n 1266 | \n Saint Seiya: The Lost Canvas | \n This anime adventure follows the battle between a saint of Athena and an avatar of Hades who's working on a painting that could destroy the world. | \n this anime adventure follows battle saint athena avatar hades 's working painting could destroy world . | \n 0.401772 | \n
\n \n 131 | \n Bad Blood | \n This sprawling crime drama follows the true story of the Rizzuto family and its associates, who presided over organized crime in Montreal for decades. | \n this sprawling crime drama follows true story rizzuto family associates , presided organized crime montreal decades . | \n 0.398790 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"recommender2('Love on the Spectrum')","execution_count":77,"outputs":[{"output_type":"execute_result","execution_count":77,"data":{"text/plain":" title \\\n1762 Ultramarine Magmell \n1759 Ugly Duckling \n7 100 Humans \n857 London Spy \n426 Durarara!! \n\n description \\\n1762 Decades after the sudden birth of a new continent, a young rescuer-for-hire provides aid to adventurers exploring this dangerous, uncharted world. \n1759 Young women face up to their insecurities and circumstances, finding love and laughs along the way. Featuring a different storyline every season. \n7 One hundred hardy souls from diverse backgrounds participate in playful experiments exploring age, sex, happiness and other aspects of being human. \n857 When his reclusive-banker lover disappears, a hard-partying young British hedonist plunges into the dangerous world of espionage to find the truth. \n426 A young man looking for excitement moves to Ikebukuro, a district in Tokyo, where he finds a world of mystery in which the past and present mesh. \n\n description_filtered \\\n1762 decades sudden birth new continent , young rescuer-for-hire provides aid adventurers exploring dangerous , uncharted world . \n1759 young women insecurities circumstances , finding love laughs along way . featuring different storyline every season . \n7 one hundred hardy souls diverse backgrounds participate playful experiments exploring age , sex , happiness aspects human . \n857 when reclusive-banker lover disappears , hard-partying young british hedonist plunges dangerous world espionage find truth . \n426 a young looking excitement moves ikebukuro , district tokyo , finds world mystery past present mesh . \n\n cos_sim \n1762 0.442339 \n1759 0.437374 \n7 0.433148 \n857 0.423900 \n426 0.416463 ","text/html":"\n\n
\n \n \n | \n title | \n description | \n description_filtered | \n cos_sim | \n
\n \n \n \n 1762 | \n Ultramarine Magmell | \n Decades after the sudden birth of a new continent, a young rescuer-for-hire provides aid to adventurers exploring this dangerous, uncharted world. | \n decades sudden birth new continent , young rescuer-for-hire provides aid adventurers exploring dangerous , uncharted world . | \n 0.442339 | \n
\n \n 1759 | \n Ugly Duckling | \n Young women face up to their insecurities and circumstances, finding love and laughs along the way. Featuring a different storyline every season. | \n young women insecurities circumstances , finding love laughs along way . featuring different storyline every season . | \n 0.437374 | \n
\n \n 7 | \n 100 Humans | \n One hundred hardy souls from diverse backgrounds participate in playful experiments exploring age, sex, happiness and other aspects of being human. | \n one hundred hardy souls diverse backgrounds participate playful experiments exploring age , sex , happiness aspects human . | \n 0.433148 | \n
\n \n 857 | \n London Spy | \n When his reclusive-banker lover disappears, a hard-partying young British hedonist plunges into the dangerous world of espionage to find the truth. | \n when reclusive-banker lover disappears , hard-partying young british hedonist plunges dangerous world espionage find truth . | \n 0.423900 | \n
\n \n 426 | \n Durarara!! | \n A young man looking for excitement moves to Ikebukuro, a district in Tokyo, where he finds a world of mystery in which the past and present mesh. | \n a young looking excitement moves ikebukuro , district tokyo , finds world mystery past present mesh . | \n 0.416463 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"recommender2('13 Reasons Why')","execution_count":78,"outputs":[{"output_type":"execute_result","execution_count":78,"data":{"text/plain":" title \\\n882 Love, Chunibyo & Other Delusions! \n467 Extracurricular \n126 Baby \n297 CLANNAD \n1095 One Day at a Time \n\n description \\\n882 High schooler Yuta wants to leave his past as a delusional weirdo behind. But his classmate Rikka has her own delusions, and she's interested in his. \n467 A model high school student who's steeped in a world of serious crime finds his double life upended when a classmate takes an interest in his secret. \n126 Fed up with their families and classmates, two teen girls from a wealthy part of Rome are drawn to the city's underworld and start leading double lives. \n297 Maladjusted high school student Tomoya's life begins to change when he befriends his classmate Nagisa and several other eccentric girls. \n1095 In a reimagining of the TV classic, a newly single Latina mother raises her teen daughter and tween son with the \"help\" of her old-school mom. \n\n description_filtered \\\n882 high schooler yuta wants leave past delusional weirdo behind . but classmate rikka delusions , 's interested . \n467 a model high school student 's steeped world serious crime finds double life upended classmate takes interest secret . \n126 fed families classmates , two teen girls wealthy part rome drawn city 's underworld start leading double lives . \n297 maladjusted high school student tomoya 's life begins change befriends classmate nagisa several eccentric girls . \n1095 in reimagining tv classic , newly single latina mother raises teen daughter tween `` help '' old-school mom . \n\n cos_sim \n882 0.472192 \n467 0.424973 \n126 0.424190 \n297 0.406562 \n1095 0.405798 ","text/html":"\n\n
\n \n \n | \n title | \n description | \n description_filtered | \n cos_sim | \n
\n \n \n \n 882 | \n Love, Chunibyo & Other Delusions! | \n High schooler Yuta wants to leave his past as a delusional weirdo behind. But his classmate Rikka has her own delusions, and she's interested in his. | \n high schooler yuta wants leave past delusional weirdo behind . but classmate rikka delusions , 's interested . | \n 0.472192 | \n
\n \n 467 | \n Extracurricular | \n A model high school student who's steeped in a world of serious crime finds his double life upended when a classmate takes an interest in his secret. | \n a model high school student 's steeped world serious crime finds double life upended classmate takes interest secret . | \n 0.424973 | \n
\n \n 126 | \n Baby | \n Fed up with their families and classmates, two teen girls from a wealthy part of Rome are drawn to the city's underworld and start leading double lives. | \n fed families classmates , two teen girls wealthy part rome drawn city 's underworld start leading double lives . | \n 0.424190 | \n
\n \n 297 | \n CLANNAD | \n Maladjusted high school student Tomoya's life begins to change when he befriends his classmate Nagisa and several other eccentric girls. | \n maladjusted high school student tomoya 's life begins change befriends classmate nagisa several eccentric girls . | \n 0.406562 | \n
\n \n 1095 | \n One Day at a Time | \n In a reimagining of the TV classic, a newly single Latina mother raises her teen daughter and tween son with the \"help\" of her old-school mom. | \n in reimagining tv classic , newly single latina mother raises teen daughter tween `` help '' old-school mom . | \n 0.405798 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"recommender2('Derry Girls')","execution_count":79,"outputs":[{"output_type":"execute_result","execution_count":79,"data":{"text/plain":" title \\\n1258 Rurouni Kenshin \n1631 The Politician \n1867 Yeh Meri Family \n1101 One-Punch Man \n940 Medici: Masters of Florence \n\n description \\\n1258 A nomadic swordsman arrives at a martial arts school in Meiji-era Japan, where he lands in the middle of a conflict involving the opium trade. \n1631 Rich kid Payton has always known he's going to be president. But first he has to navigate the most treacherous political landscape of all: high school. \n1867 In the summer of 1998, middle child Harshu balances school, family, friendship and other challenges of growing up. \n1101 The most powerful superhero in the world can kill anyone with one blow. But nothing can challenge him, so he struggles with ennui and depression. \n940 After his father's murder, banking heir Cosimo Medici battles opponents of his artistic, economic and political visions for 15th-century Florence. \n\n description_filtered \\\n1258 a nomadic swordsman arrives martial arts school meiji-era japan , lands middle conflict involving opium trade . \n1631 rich kid payton always known 's going president . but first navigate treacherous political landscape : high school . \n1867 in summer 1998 , middle child harshu balances school , family , friendship challenges growing . \n1101 the powerful superhero world kill anyone blow . but nothing challenge , struggles ennui depression . \n940 after father 's murder , banking heir cosimo medici battles opponents artistic , economic political visions 15th-century florence . \n\n cos_sim \n1258 0.449171 \n1631 0.437361 \n1867 0.425046 \n1101 0.419330 \n940 0.417407 ","text/html":"\n\n
\n \n \n | \n title | \n description | \n description_filtered | \n cos_sim | \n
\n \n \n \n 1258 | \n Rurouni Kenshin | \n A nomadic swordsman arrives at a martial arts school in Meiji-era Japan, where he lands in the middle of a conflict involving the opium trade. | \n a nomadic swordsman arrives martial arts school meiji-era japan , lands middle conflict involving opium trade . | \n 0.449171 | \n
\n \n 1631 | \n The Politician | \n Rich kid Payton has always known he's going to be president. But first he has to navigate the most treacherous political landscape of all: high school. | \n rich kid payton always known 's going president . but first navigate treacherous political landscape : high school . | \n 0.437361 | \n
\n \n 1867 | \n Yeh Meri Family | \n In the summer of 1998, middle child Harshu balances school, family, friendship and other challenges of growing up. | \n in summer 1998 , middle child harshu balances school , family , friendship challenges growing . | \n 0.425046 | \n
\n \n 1101 | \n One-Punch Man | \n The most powerful superhero in the world can kill anyone with one blow. But nothing can challenge him, so he struggles with ennui and depression. | \n the powerful superhero world kill anyone blow . but nothing challenge , struggles ennui depression . | \n 0.419330 | \n
\n \n 940 | \n Medici: Masters of Florence | \n After his father's murder, banking heir Cosimo Medici battles opponents of his artistic, economic and political visions for 15th-century Florence. | \n after father 's murder , banking heir cosimo medici battles opponents artistic , economic political visions 15th-century florence . | \n 0.417407 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"recommender2('Breaking Bad')","execution_count":80,"outputs":[{"output_type":"execute_result","execution_count":80,"data":{"text/plain":" title \\\n996 Mr. Iglesias \n931 Marvel's The Punisher \n1297 Servant of the People \n443 El Reemplazante \n132 Bad Education \n\n description \\\n996 Hilarious high school teacher Gabriel Iglesias tries to make a difference in the lives of some smart but underperforming students at his alma mater. \n931 A former Marine out to punish the criminals responsible for his family's murder finds himself ensnared in a military conspiracy. \n1297 After a Ukrainian high school teacher's tirade against government corruption goes viral on social media, he finds himself the country's new president. \n443 A former high-ranking financial executive finds redemption and romance when he's paroled after a prison sentence and becomes a math teacher. \n132 A history teacher at the posh Abbey Grove, Alfie Wickers is something truly special: He's his school's, if not England's, single worst educator. \n\n description_filtered \\\n996 hilarious high school teacher gabriel iglesias tries make difference lives smart underperforming students alma mater . \n931 a former marine punish criminals responsible family 's murder finds ensnared military conspiracy . \n1297 after ukrainian high school teacher 's tirade government corruption goes viral social media , finds country 's new president . \n443 a former high-ranking financial executive finds redemption romance 's paroled prison sentence becomes math teacher . \n132 a history teacher posh abbey grove , alfie wickers something truly special : he 's school 's , england 's , single worst educator . \n\n cos_sim \n996 0.467099 \n931 0.456435 \n1297 0.453632 \n443 0.443622 \n132 0.412479 ","text/html":"\n\n
\n \n \n | \n title | \n description | \n description_filtered | \n cos_sim | \n
\n \n \n \n 996 | \n Mr. Iglesias | \n Hilarious high school teacher Gabriel Iglesias tries to make a difference in the lives of some smart but underperforming students at his alma mater. | \n hilarious high school teacher gabriel iglesias tries make difference lives smart underperforming students alma mater . | \n 0.467099 | \n
\n \n 931 | \n Marvel's The Punisher | \n A former Marine out to punish the criminals responsible for his family's murder finds himself ensnared in a military conspiracy. | \n a former marine punish criminals responsible family 's murder finds ensnared military conspiracy . | \n 0.456435 | \n
\n \n 1297 | \n Servant of the People | \n After a Ukrainian high school teacher's tirade against government corruption goes viral on social media, he finds himself the country's new president. | \n after ukrainian high school teacher 's tirade government corruption goes viral social media , finds country 's new president . | \n 0.453632 | \n
\n \n 443 | \n El Reemplazante | \n A former high-ranking financial executive finds redemption and romance when he's paroled after a prison sentence and becomes a math teacher. | \n a former high-ranking financial executive finds redemption romance 's paroled prison sentence becomes math teacher . | \n 0.443622 | \n
\n \n 132 | \n Bad Education | \n A history teacher at the posh Abbey Grove, Alfie Wickers is something truly special: He's his school's, if not England's, single worst educator. | \n a history teacher posh abbey grove , alfie wickers something truly special : he 's school 's , england 's , single worst educator . | \n 0.412479 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"recommender2('Stranger Things')","execution_count":81,"outputs":[{"output_type":"execute_result","execution_count":81,"data":{"text/plain":" title \\\n727 Jamtara - Sabka Number Ayega \n186 Bitter Daisies \n1121 Paradise PD \n1267 Sakho & Mangane \n1650 The Search \n\n description \\\n727 A group of small-town young men run a lucrative phishing operation, until a corrupt politician wants in on their scheme – and a cop wants to fight it. \n186 While investigating the disappearance of a teen girl in a tight-knit Galician town, a Civil Guard officer uncovers secrets linked to a loss of her own. \n1121 An eager young rookie joins the ragtag small-town police force led by his dad as they bumble, squabble and snort their way through a big drug case. \n1267 A by-the-book police captain and a brash young detective must team up to take on the supernatural when strange forces begin to wreak havoc on Dakar. \n1650 When a girl vanishes from a suburb near Mexico City, the personal goals of some involved in the case muddy the search. Based on a true story. \n\n description_filtered \\\n727 a group small-town young run lucrative phishing operation , corrupt politician wants scheme – cop wants fight . \n186 while investigating disappearance teen girl tight-knit galician town , civil guard officer uncovers secrets linked loss . \n1121 an eager young rookie joins ragtag small-town police force led dad bumble , squabble snort way big case . \n1267 a by-the-book police captain brash young detective must team supernatural strange forces begin wreak havoc dakar . \n1650 when girl vanishes suburb near mexico city , personal goals involved case muddy search . based true story . \n\n cos_sim \n727 0.469790 \n186 0.455468 \n1121 0.443310 \n1267 0.435665 \n1650 0.428929 ","text/html":"\n\n
\n \n \n | \n title | \n description | \n description_filtered | \n cos_sim | \n
\n \n \n \n 727 | \n Jamtara - Sabka Number Ayega | \n A group of small-town young men run a lucrative phishing operation, until a corrupt politician wants in on their scheme – and a cop wants to fight it. | \n a group small-town young run lucrative phishing operation , corrupt politician wants scheme – cop wants fight . | \n 0.469790 | \n
\n \n 186 | \n Bitter Daisies | \n While investigating the disappearance of a teen girl in a tight-knit Galician town, a Civil Guard officer uncovers secrets linked to a loss of her own. | \n while investigating disappearance teen girl tight-knit galician town , civil guard officer uncovers secrets linked loss . | \n 0.455468 | \n
\n \n 1121 | \n Paradise PD | \n An eager young rookie joins the ragtag small-town police force led by his dad as they bumble, squabble and snort their way through a big drug case. | \n an eager young rookie joins ragtag small-town police force led dad bumble , squabble snort way big case . | \n 0.443310 | \n
\n \n 1267 | \n Sakho & Mangane | \n A by-the-book police captain and a brash young detective must team up to take on the supernatural when strange forces begin to wreak havoc on Dakar. | \n a by-the-book police captain brash young detective must team supernatural strange forces begin wreak havoc dakar . | \n 0.435665 | \n
\n \n 1650 | \n The Search | \n When a girl vanishes from a suburb near Mexico City, the personal goals of some involved in the case muddy the search. Based on a true story. | \n when girl vanishes suburb near mexico city , personal goals involved case muddy search . based true story . | \n 0.428929 | \n
\n \n
\n
"},"metadata":{}}]},{"metadata":{},"cell_type":"markdown","source":"# 6. Conclusion\n\nTaking the cast, director, country, rating and genres as features rather than the descriptions was definitely the better option. Some of the recommendations by descriptions are good such as the 'Tinker Bell and the Legend of the NeverBeast' recommendation for 'Hook' and the 'Extracurricular' recommendation for '13 Reasons Why', but most of them are from completely different genres with very little in common besides a few key words."}],"metadata":{"kernelspec":{"name":"python3","display_name":"Python 3","language":"python"},"language_info":{"name":"python","version":"3.7.9","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat":4,"nbformat_minor":4}