With the rapid growth of online streaming platforms, users are overwhelmed by the sheer number of movies available. Recommender systems help users discover relevant content by analyzing past interactions and preferences.
The goal of this project is to:
- Analyze large-scale movie rating data using Spark SQL
- Build a personalized movie recommendation system using ALS (Alternating Least Squares)
- Store and process data using a distributed HDFS environment
- Demonstrate Big Data concepts such as distributed storage, parallel computation, and ML pipelines
| Category | Technology |
|---|---|
| Big Data Framework | Apache Spark 3.5.1 |
| Storage | HDFS (Hadoop 3.3.6) |
| Language | Python (PySpark) |
| ML Library | Spark MLlib (ALS) |
| Query Engine | Spark SQL |
| Dataset | MovieLens (ml-latest-small) |
| OS | Ubuntu (WSL2) |
| IDE | IntelliJ IDEA / VS Code |
Ensure the following are installed:
- Java 11
- Hadoop 3.3.6
- Spark 3.5.1 (Hadoop-compatible build)
- Python 3.12
- WSL2 (Ubuntu)
Add the following to your .bashrc or .zshrc:
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
export HADOOP_HOME=~/hadoop-3.3.6
export SPARK_HOME=~/spark-3.5.1-bin-hadoop3
export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$SPARK_HOME/bin
export PYTHONPATH=$SPARK_HOME/python:$SPARK_HOME/python/lib/py4j-0.10.9.7-src.zip
export PYSPARK_PYTHON=python3.11
export PYSPARK_DRIVER_PYTHON=python3.11Add these environment variables using the command :
nano ~/.bashrcAfter adding it, save it using the command :
Ctrl + O -> Enter
Ctrl + XNow, apply the changes made using the command :
source ~/.bashrccd ~/hadoop-3.3.6
sbin/start-dfs.sh
jpsEnsure
NameNode, DataNode, and
SecondaryNameNodeare running.
hdfs dfs -mkdir -p /user/<username>/movielens/ml-latest-small
hdfs dfs -put *.csv /user/<username>/movielens/ml-latest-smallVerify:
hdfs dfs -ls /user/<username>/movielens/ml-latest-smallcd ~/IdeaProjects/MovieRecommendationSystem
spark-submit spark/spark_sql_analysis.py
spark-submit spark/als_recommender.py
- The ALS model successfully learns latent user and movie factors
- Popular movies tend to have higher rating counts but not always higher ratings
- RMSE and MAE values indicate acceptable prediction accuracy for a dataset containing 100,000 ratings and 3,600 tag applications applied to 9,000 movies by 600 users.
- Using HDFS enables scalable storage and fault tolerance
- Spark SQL efficiently handles analytical queries over large datasets.
- Scale to MovieLens 20M / 25M dataset
- Add implicit feedback (views, clicks)
- Implement Top-N ranking metrics (Precision@K, Recall@K)
- Add genre-based recommendations.
- Integrate real-time streaming (Kafka + Spark Streaming)
- Build a REST API / Web UI for recommendations.
- Compare ALS with content-based filtering
Author: Shrika Thota