<jupyter_start><jupyter_text>Importing Libraries<jupyter_code>import pandas as pd<jupyter_output><empty_output><jupyter_text>Helper methods<jupyter_code>def get_similar_movies(movie_name,user_rating):
    similar_score = item_similarity_df[movie_name]*(user_rating-2.5)
    similar_score = similar_score.sort_values(ascending=False)
    return similar_score<jupyter_output><empty_output><jupyter_text>Reading files and creating data frames<jupyter_code>ratings = pd.read_csv("ratings.csv")
movies = pd.read_csv("movies.csv")
ratings = pd.merge(movies, ratings).drop(["genres", "timestamp", "movieId"], axis=1)
user_ratings = ratings.pivot_table(index=['userId'],columns=['title'],values='rating')
user_ratings = user_ratings.dropna(thresh=10,axis=1).fillna(0)
item_similarity_df = user_ratings.corr(method='pearson')<jupyter_output><empty_output><jupyter_text>Recommendation code<jupyter_code>action_lover = [("Catch Me If You Can (2002)",5),
                ("12 Years a Slave (2013)",3),
                ("2012 (2009)",3),
                ("(500) Days of Summer (2009)",5),
                ("28 Days Later (2002)",4),
                ("Deadpool 2 (2018)",4),
                ("Blood Diamond (2006)",4),
                ("Up in the Air (2009)",4),
                ("I Am Legend (2007)",5),
                ("Titanic (1997)",5),
                ("Up (2009)",4),
                ("<NAME> (2008)",4),
                ("I Am Legend (2007)",5),
                ("<NAME> (2009)",4),
                ("Da Vinci Code, The (2006)",4),
                ("<NAME> (2006)",4),
                ("300 (2007)",2),
                ("War of the Worlds (2005)",2),
                ("Scott Pilgrim vs. the World (2010)",3),
                ("Casino Royale (2006)",4),
                ("Prestige, The (2006)",4),
                ("Wrestler, The (2008)",4),
                ("Mad Max: Fury Road (2015)",5),
                ("King Kong (2005)",5),
                ("Minority Report (2002)",4),
                ("Edge of Tomorrow (2014)",4),
                ("Django Unchained (2012)",3),
                ("Troy (2004)",3),
                ("Star Trek (2009)",4),
                ("<NAME> (2008)",4),
                ("Black Hawk Down (2001)",4),
                ("Social Network, The (2010)",4),
                ("V for Vendetta (2006)",2)]

similar_movies = pd.DataFrame()

for movie,rating in action_lover:
    similar_movies = similar_movies.append(get_similar_movies(movie,rating),ignore_index=True)

all_recommend = similar_movies.sum().sort_values(ascending=False)

for movie,score in all_recommend.iteritems():
    print(movie)<jupyter_output>I Am Legend (2007)
<NAME> (2009)
Hangover, The (2009)
Avatar (2009)
<NAME> (2006)
Iron Man (2008)
300 (2007)
Catch Me If You Can (2002)
Up in the Air (2009)
King Kong (2005)
Star Wars: Episode III - Revenge of the Sith (2005)
Scott Pilgrim vs. the World (2010)
<NAME> (2008)
District 9 (2009)
Mad Max: Fury Road (2015)
Zombieland (2009)
Blood Diamond (2006)
Batman Begins (2005)
Up (2009)
Day After Tomorrow, The (2004)
Kick-Ass (2010)
I, Robot (2004)
Da Vinci Code, The (2006)
WALL·E (2008)
Pirates of the Caribbean: Dead Man's Chest (2006)
Quantum of Solace (2008)
Wedding Crashers (2005)
Prestige, The (2006)
X-Men Origins: Wolverine (2009)
War of the Worlds (2005)
Star Trek (2009)
Zodiac (2007)
Sin City (2005)
Dark Knight, The (2008)
Incredible Hulk, The (2008)
X-Men: First Class (2011)
Incredibles, The (2004)
Edge of Tomorrow (2014)
Fantastic Four (2005)
Taken (2008)
Hurt Locker, The (2008)
Toy Story 3 (2010)
Hot Fuzz (2007)
Hellboy (2004)
Kill Bill: Vol. 1 (2003)
V[...]
{'fraction_non_alphanumeric': 0.15378221113881962, 'fraction_numerical': 0.10335272928789138, 'mean_word_length': 3.002217294900222, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '606769', 'license': 'Apache-2.0', 'n_tokens_mistral': 1524, 'n_tokens_neox': 1193, 'n_words': 325, 'path': 'collaborative-filtering/movie_recommendation_bulk.ipynb', 'repo_name': 'harshp2124/Movie-Recommendation', 'size': '3662'}