Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Movie Recommendation — Collaborative Filtering

A simple item-based collaborative-filtering movie recommender built with pandas and the MovieLens dataset. Given a few movies a user has rated, it surfaces other movies that similar viewers also liked.

How it works

  1. Load ratings.csv and movies.csv and merge on movieId.
  2. Pivot into a user × movie ratings table.
  3. Drop movies with fewer than 10 ratings (too noisy) and fill the rest with 0.
  4. Compute a Pearson correlation matrix between every pair of movies.
  5. Given a list of (movie_title, user_rating) tuples, weight each movie's correlation column by (rating - 2.5) — positive for liked, negative for disliked — and sum across all input movies to score candidates.

Result: the top-scoring movies are the recommendations.

Dataset

Uses the MovieLens small dataset (included in dataset/):

  • movies.csv — movie IDs and titles
  • ratings.csv — user ratings (0.5–5 stars)
  • tags.csv, links.csv — unused by this script

Requirements

  • Python 3
  • pandas
  • scipy
pip install pandas scipy

Running

python temp.py

Two demo profiles are baked in — a "romantic_lover" and an "action_lover" preference list — both print their top-20 recommended movies. Edit the lists at the bottom of temp.py to try your own.

About

Item-based collaborative-filtering movie recommender using Pearson correlation and the MovieLens dataset

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages