This project focuses on developing a movie recommendation system using neighborhood-based collaborative filtering algorithms. The system analyzes past user interactions, such as views, ratings, and purchases, to generate personalized movie recommendations.
In the first part of the project, the program reads an input file (train.csv
) and outputs the top 10 users and movies based on their rating count.
- iostream: Provides input/output stream objects.
- fstream: Provides file stream objects.
- map: Allows efficient lookup and insertion of elements using key-value pairs.
- string: Represents a sequence of characters.
- algorithm: Provides various algorithms such as sorting.
-
Data Structures:
user_ratings
: A map storing user IDs and their corresponding rating counts.movie_ratings
: A map storing movie IDs and their corresponding rating counts.
-
File Handling:
- Opens
train.csv
, reads the file line by line, extracts user and movie IDs, and increments their respective counts.
- Opens
-
Sorting and Output:
- Sorts the maps in decreasing order of rating counts and prints the top 10 users and movies.
In the second part, the aim is to create a movie recommendation system utilizing collaborative filtering algorithms.
train.csv
: Contains historical ratings used to build the recommendation model.test.csv
: Used for testing the model's predictions.
- , , , <unordered_map>, , , etc.
-
Cosine Similarity Function:
- A function is defined to calculate cosine similarity between two vectors.
-
Model Building:
- Reads data from
train.csv
andtest.csv
, storing user ratings in a hash map.
- Reads data from
-
Predictions:
- For each item in the test data, it calculates predicted ratings using both user-based and item-based collaborative filtering.
-
Output:
- Writes the user ID, item ID, and predicted rating to
submission.csv
.
- Writes the user ID, item ID, and predicted rating to
- C++
- Collaborative Filtering Algorithms
- File I/O for Data Handling
This project effectively demonstrates the use of data structures and algorithms in building a movie recommendation system, highlighting the importance of collaborative filtering in providing personalized experiences.