<jupyter_start><jupyter_text>**IDM Movie Recommendation System**<jupyter_code>import pandas as pd
import numpy as np
import warnings
warnings.filterwarnings('ignore')
path_movies = 'C:/dataset/recomendation_sys/movies/movies.csv'
path_ratings = 'C:/dataset/recomendation_sys/movies/ratings.csv'

movies = pd.read_csv(path_movies, sep=',') 
ratings = pd.read_csv(path_ratings, sep=',')
movies.head(2)
ratings.head(2)
print('movies:', movies.shape)
print('ratings:', ratings.shape)
movies = movies.rename(index=str, columns={'movieId': 'movie_id'})
ratings = ratings.rename(index=str, columns={'userId': 'user_id', 'movieId': 'movie_id'})
movies = movies.merge(ratings, on='movie_id')
movies.head(2)
vote_count = movies['title'].value_counts().values
titles = movies['title'].value_counts().keys()
titles_votes = pd.DataFrame([titles, vote_count]).T
titles_votes = titles_votes.rename(index=str, columns={0: 'title', 1: 'num_vote'})
movies = movies.merge(titles_votes, on='title')
movies[movies.genres == '(no genres listed)']
movies.genres.iloc[105063] = 'Drama|Mistery'
movies.genres.iloc[105239] = 'Documentary|Animation'
movies.genres.iloc[105278] = 'Musical|Comedy'
movies.genres.iloc[105306] = 'Comedy'
movies.genres.iloc[105308] = 'Documentary'
movies.genres.iloc[105323] = 'Drama'
movies.genres.iloc[105338] = 'Drama'
movies.head()
V = movies['num_vote']
R = movies['rating']
C = movies['rating'].mean()
m = movies['num_vote'].quantile(0.7)

movies['weight_avg'] = (V/(V+m) * R) + (m/(m+V) * C)
movies.head()<jupyter_output><empty_output><jupyter_text>**RECOMENDATIONS v1**<jupyter_code>import matplotlib.pyplot as plt
import seaborn as sns

movie_rank = movies[['title', 'weight_avg']].sort_values(by='weight_avg', ascending=False).drop_duplicates()

plt.figure(figsize=(14,6))

ax = sns.barplot(x=movie_rank['weight_avg'].head(10), y=movie_rank['title'].head(10), data=movie_rank, palette='deep')

plt.xlim(4.5, 4.75)
plt.title('"Best" Movies by TMDB Votes', weight='bold')
plt.xlabel('Weighted Average Score', weight='bold')
plt.ylabel('Movie Title', weight='bold')
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18534278959810874, 'fraction_numerical': 0.029314420803782507, 'mean_word_length': 8.240174672489083, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '412104', 'license': 'MIT', 'n_tokens_mistral': 887, 'n_tokens_neox': 836, 'n_words': 127, 'path': 'recommendation_sys/movies/idm_recommendation.ipynb', 'repo_name': 'dspauloplima/data_science_projects', 'size': '2115'}