diff --git "a/Recommedation_System_Netflix.ipynb" "b/Recommedation_System_Netflix.ipynb" new file mode 100644--- /dev/null +++ "b/Recommedation_System_Netflix.ipynb" @@ -0,0 +1,1813 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Netflix Content Recommendation System\n", + "This notebook implements a hybrid recommendation system for Netflix movies and TV shows using:\n", + "1. Content-based filtering with TF-IDF vectorization and cosine similarity\n", + "2. Collaborative filtering based on user preferences\n", + "3. Node representation learning for enhanced content understanding" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": {}, + "outputs": [], + "source": [ + "import pandas as pd\n", + "import numpy as np\n", + "from sklearn.feature_extraction.text import TfidfVectorizer\n", + "from sklearn.metrics.pairwise import cosine_similarity\n", + "import matplotlib.pyplot as plt\n", + "import seaborn as sns\n", + "import plotly.express as px\n", + "import plotly.graph_objects as go\n", + "from scipy.sparse.linalg import svds\n", + "import networkx as nx\n", + "from node2vec import Node2Vec" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 1. Data Loading and Preprocessing" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\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", + "
---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", + "s1 | \n", + "Movie | \n", + "Dick Johnson Is Dead | \n", + "Kirsten Johnson | \n", + "NaN | \n", + "United States | \n", + "September 25, 2021 | \n", + "2020 | \n", + "PG-13 | \n", + "90 min | \n", + "Documentaries | \n", + "As her father nears the end of his life, filmm... | \n", + "
1 | \n", + "s2 | \n", + "TV Show | \n", + "Blood & Water | \n", + "NaN | \n", + "Ama Qamata, Khosi Ngema, Gail Mabalane, Thaban... | \n", + "South Africa | \n", + "September 24, 2021 | \n", + "2021 | \n", + "TV-MA | \n", + "2 Seasons | \n", + "International TV Shows, TV Dramas, TV Mysteries | \n", + "After crossing paths at a party, a Cape Town t... | \n", + "
2 | \n", + "s3 | \n", + "TV Show | \n", + "Ganglands | \n", + "Julien Leclercq | \n", + "Sami Bouajila, Tracy Gotoas, Samuel Jouy, Nabi... | \n", + "NaN | \n", + "September 24, 2021 | \n", + "2021 | \n", + "TV-MA | \n", + "1 Season | \n", + "Crime TV Shows, International TV Shows, TV Act... | \n", + "To protect his family from a powerful drug lor... | \n", + "
3 | \n", + "s4 | \n", + "TV Show | \n", + "Jailbirds New Orleans | \n", + "NaN | \n", + "NaN | \n", + "NaN | \n", + "September 24, 2021 | \n", + "2021 | \n", + "TV-MA | \n", + "1 Season | \n", + "Docuseries, Reality TV | \n", + "Feuds, flirtations and toilet talk go down amo... | \n", + "
4 | \n", + "s5 | \n", + "TV Show | \n", + "Kota Factory | \n", + "NaN | \n", + "Mayur More, Jitendra Kumar, Ranjan Raj, Alam K... | \n", + "India | \n", + "September 24, 2021 | \n", + "2021 | \n", + "TV-MA | \n", + "2 Seasons | \n", + "International TV Shows, Romantic TV Shows, TV ... | \n", + "In a city of coaching centers known to train I... | \n", + "
\n", + " | title | \n", + "type | \n", + "similarity_score | \n", + "description | \n", + "genres | \n", + "score_components | \n", + "
---|---|---|---|---|---|---|
0 | \n", + "Earth's Natural Wonders: Life at the Extremes | \n", + "TV Show | \n", + "0.700000 | \n", + "From the Arctic to the Outback, humans battle ... | \n", + "British TV Shows, Docuseries, Science & Nature TV | \n", + "{'content': 1.0, 'node_embeddings': 0} | \n", + "
1 | \n", + "Forces of Nature | \n", + "TV Show | \n", + "0.645211 | \n", + "This dynamic series spans the globe to explain... | \n", + "British TV Shows, Docuseries, Science & Nature TV | \n", + "{'content': 0.9217306157371645, 'node_embeddin... | \n", + "
2 | \n", + "SHOT! The Psycho-Spiritual Mantra of Rock | \n", + "Movie | \n", + "0.616144 | \n", + "Aptly named iconic rock photographer Mick Rock... | \n", + "Documentaries, Music & Musicals | \n", + "{'content': 0.8802054225172214, 'node_embeddin... | \n", + "
3 | \n", + "Big Timber | \n", + "TV Show | \n", + "0.611720 | \n", + "A no-nonsense logger and his loyal crew battle... | \n", + "International TV Shows, Reality TV | \n", + "{'content': 0.8738863005015717, 'node_embeddin... | \n", + "
4 | \n", + "Stranger Things | \n", + "TV Show | \n", + "0.570549 | \n", + "When a young boy vanishes, a small town uncove... | \n", + "TV Horror, TV Mysteries, TV Sci-Fi & Fantasy | \n", + "{'content': 0.8150702655793096, 'node_embeddin... | \n", + "
5 | \n", + "Malibu Rescue: The Series | \n", + "TV Show | \n", + "0.546840 | \n", + "On the heels of Junior Rescue training, Team F... | \n", + "Kids' TV, TV Action & Adventure, TV Comedies | \n", + "{'content': 0.7812004133811242, 'node_embeddin... | \n", + "
6 | \n", + "Anjaan: Special Crimes Unit | \n", + "TV Show | \n", + "0.532292 | \n", + "The cases are supernatural; the police officer... | \n", + "International TV Shows, TV Horror, TV Mysteries | \n", + "{'content': 0.7604168983953697, 'node_embeddin... | \n", + "
7 | \n", + "Kanika | \n", + "Movie | \n", + "0.530911 | \n", + "A doctor and his colleagues who use sex-determ... | \n", + "Horror Movies, International Movies, Thrillers | \n", + "{'content': 0.7584437541674386, 'node_embeddin... | \n", + "
8 | \n", + "Family Blood | \n", + "Movie | \n", + "0.515466 | \n", + "A former addict moves to a new city with her c... | \n", + "Horror Movies | \n", + "{'content': 0.7363798992891963, 'node_embeddin... | \n", + "
9 | \n", + "Gormiti | \n", + "TV Show | \n", + "0.515033 | \n", + "Four friends become guardians of the island Go... | \n", + "Kids' TV | \n", + "{'content': 0.7357621069028203, 'node_embeddin... | \n", + "