CodSoft Data Science Internship โ€ข Task 2

Movie Rating
Prediction

A complete Machine Learning regression pipeline that predicts IMDb movie ratings using 6 regression algorithms with hyperparameter tuning, analyzing features like genre, director, actors, duration, and votes.

Python 3.11+ Scikit-Learn Pandas Matplotlib Seaborn Regression

15K+

Movies

6

ML Models

12+

Engineered Features

0.74

Rยฒ Score

Project Overview

Understanding the business problem and dataset

๐ŸŽฏ

Business Problem

Movie ratings are crucial for studios, streaming platforms, and audiences. This project builds a regression model to predict IMDb ratings based on movie attributes.

By analyzing factors like genre, director reputation, cast star power, duration, and audience engagement (votes), we can estimate how well a movie will be received.

๐Ÿ“Š

Dataset

Source Kaggle (IMDb India)
Rows ~15,000+
Columns 10
Target Rating
Task Regression
Rating Range 0 - 10
๐Ÿ“‹

Dataset Features

Column Type Description

ML Pipeline

End-to-end workflow executed by python main.py

๐Ÿงน Data Preprocessing

โœ“
Year โ€” Extract first 4-digit year from ranges like "2019-2020"
โœ“
Duration โ€” Parse minutes from "120 min" format
โœ“
Votes โ€” Remove comma separators, convert to integer
โœ“
Rating โ€” Filter valid 0-10 range, drop missing
โœ“
Missing Values โ€” Median imputation for numeric, "Unknown" for text
โœ“
Scaling โ€” StandardScaler normalization

โš™๏ธ Feature Engineering

Project Structure

Complete file organization

Models & Evaluation

6 regression algorithms trained and compared

๐Ÿ“ Regression Metrics Explained

๐Ÿ”ง Hyperparameter Tuning

GridSearchCV with 5-fold cross-validation is performed on the top 2 models. The search explores combinations of hyperparameters to find the optimal configuration that maximizes Rยฒ score.

Random Forest Search Space

n_estimators: [100, 200, 300]
max_depth: [5, 10, 15, None]
min_samples_split: [2, 5]
min_samples_leaf: [1, 2]

Gradient Boosting Search Space

n_estimators: [100, 200, 300]
learning_rate: [0.01, 0.05, 0.1]
max_depth: [3, 5, 7]
min_samples_split: [2, 5]

Code Preview

Key source files from the project

Results & Outputs

Model performance and generated artifacts

๐Ÿ† Best Model Performance

Model

Gradient Boosting

Test Rยฒ

0.7416

CV Rยฒ

0.7544

RMSE

0.6931

MAE

0.4796

๐Ÿ“Š model_comparison.csv

Performance table comparing all 6 models across MAE, RMSE, Rยฒ, and CV scores.

๐Ÿ“ˆ predictions.csv

Test set predictions with actual ratings, predicted ratings, and absolute errors.

๐Ÿค– movie_rating_model.pkl

Serialized best model saved with Joblib for reuse without retraining.

Generated Visualizations (12 plots)

How to Run

Step-by-step instructions

1

Clone & Setup

git clone https://github.com/yourusername/Movie_Rating_Prediction.git
cd Movie_Rating_Prediction
python -m venv venv
source venv/bin/activate  # or venv\Scripts\activate on Windows
pip install -r requirements.txt
2

Download Dataset

Download from Kaggle and place IMDb_Movies_India.csv in the dataset/ folder.

3

Run the Pipeline

python main.py

This executes the complete ML pipeline automatically.

4

Or Run Notebook

cd notebook
jupyter notebook Movie_Rating_Prediction.ipynb

โšก What python main.py does