Downloads ยท 30 days
0
harry120/zomato-rating-predictor
zomato-rating-predictor is a machine learning model from harry120. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
๐ Click Here to Watch the Video Explanation ๐) (Please watch the video for a complete walkthrough of the code, analysis, and insights)
Downloads ยท 30 days
0
Access
Public
Updated Dec 8, 2025
Repo size
167 MB
Likes
0
Public
Click a slice to open those files.
.pkl164 MB ยท 95%
From the Hugging Face model README
๐ Click Here to Watch the Video Explanation ๐) (Please watch the video for a complete walkthrough of the code, analysis, and insights)
This project tackles a classic problem in the food-tech industry: Predicting the success of a restaurant based on its features. Using the Zomato Bangalore dataset, we built a machine learning pipeline to predict the Rating (1-5) of a restaurant using two approaches:
We started by analyzing the data distributions to understand what drives a high rating.
To ensure data quality, we performed the following steps:
rate (target variable) as they constitute a small portion of the data. For missing approx_cost, we imputed values using the median cost of the specific sub-zone.rate from string (e.g., "4.1/5") to float, and cleaned cost by removing currency symbols and commas.Before modeling, we visualized the relationship between ratings and key operational features.
Insights from the graph above:
While analyzing costs, we noticed significant outliers that could skew our predictions. As seen below, the cost distribution required normalization.

We trained a simple Linear Regression model on the raw data to establish a baseline. The results were poor ($R^2 = 0.28$), confirming that the relationships are non-linear and that extensive feature engineering is required.

To improve performance, we applied:
votes and cost.cuisines, location).๐ Ablation Study - What made the difference?
The jump from a baseline $R^2$ of 0.28 to the final 0.93 was not magic. Our analysis showed that Target Encoding on the cuisines feature provided the most significant performance boost (improving $R^2$ by ~0.4), followed by the K-Means Cluster feature which helped the model distinguish between different restaurant business models.
Using the Elbow Method, we identified K=6 as the optimal number of clusters.

We visualized these clusters using PCA (Principal Component Analysis), which showed distinct separation between different market segments (e.g., Budget Delivery vs. Premium Dining).

The K-Means analysis (K=6) provided a granular segmentation of the market. By analyzing the centroids, we identified 6 distinct restaurant archetypes:
We trained three models on the engineered data: Linear Regression, Decision Tree, and Random Forest.
The Feature Engineering provided a massive boost, with Random Forest emerging as the clear winner.

What drives a high rating?
According to the Feature Importance plot below, the specific Cuisine and the number of Votes (Social Proof) are the most critical factors. Interestingly, while Table Booking was visually distinct in EDA, the model found that purely content-based features (Cuisine/Votes) hold more predictive power.

Accuracy Check (Actual vs. Predicted):
The points align perfectly on the red diagonal line, showing high prediction accuracy.

Despite high accuracy, manual inspection of the errors revealed two patterns:
We reframed the problem to answer a business question: "Should we recommend this restaurant?"
The data is well balanced between "Low" (0) and "High" (1) rated restaurants.

1. Logistic Regression (Baseline):
Precision is 0.86. Decent, but too many errors.

2. XGBoost:
Precision is 0.95. Very strong.

3. Random Forest (Winner ๐):
Precision is 0.98. The model almost never recommends a bad restaurant.

We successfully built a robust predictor.
notebook.ipynb: The complete Python code for the project.zomato_rf_model.pkl: The winning Regression model.zomato_classification_model.pkl: The winning Classification model.