Skip to content

Sayan7anDa5/RentRadar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

22 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🏠 RentRadar β€” Indian Rental Market Intelligence

Predict a fair rent for any Indian flat, and instantly tell whether a listing is a good deal or overpriced.

RentRadar is an end-to-end data product built on ~7,500 real rental listings across five Indian cities. It cleans messy listing data, uncovers what actually drives rent through statistical testing, trains a machine-learning model to predict fair prices, and serves it all through an interactive web app.

πŸ”— Try the live app Β Β·Β  πŸ“Š See the findings Β Β·Β  🧠 How it works


What it does

A renter looking at a flat asks two questions: "What should this cost?" and "Am I getting ripped off?" RentRadar answers both.

  • Estimates fair rent for any flat from its city, locality, size, bedrooms, bathrooms, and furnishing.
  • Flags the deal β€” enter what a listing is asking, and RentRadar labels it Good Deal, Fairly Priced, or Overpriced, with the percentage difference from fair value.

Key findings

Before modeling, I explored the data and statistically tested what drives rent. All three findings are significant at p < 0.05.

1. Furnished flats command a real premium. Furnished flats rent for roughly β‚Ή19,700 more per month than unfurnished ones. A Welch's t-test confirmed the gap is significant (t = 12.56, p β‰ˆ 3Γ—10⁻³⁡) β€” not random noise.

Rent by furnishing

2. Rent rises sharply with bedroom count. Average rent roughly doubles with each bedroom from 1 to 4 BHK. One-way ANOVA confirmed the differences are significant (F = 1341, p β‰ˆ 0). Higher BHK categories (5+) were excluded due to too few samples.

Rent by bedrooms

3. Cities differ dramatically. Mumbai is the most expensive (~β‚Ή73,000 average), Nagpur the cheapest (~β‚Ή18,000) β€” a ~4Γ— spread. ANOVA confirmed the city effect is significant (F = 285, p β‰ˆ 6Γ—10⁻²²⁹).

Rent by city

Which groups differ? A one-way ANOVA only says at least one group stands out. Post-hoc Tukey HSD (which corrects for multiple comparisons) shows the differences are pervasive, not driven by a single outlier: all 10 city pairs differ significantly β€” even the closest, New Delhi vs Pune β€” and all 6 bedroom pairs (1–4 BHK) differ significantly. No two cities, and no two adjacent BHK levels, are statistically interchangeable.

Note on interpretation: these tests establish statistical association, not proven causation. The bedroom and city effects partly reflect differences in flat size and location.


The model

I framed fair-rent prediction as a regression problem and benchmarked every model against a deliberately simple baseline.

Model RMSE (avg error) vs. baseline
Baseline (locality average) β‚Ή41,434 β€”
Linear Regression β‚Ή30,407 better
Random Forest β‚Ή29,180 30% better

The Random Forest beat the naive baseline by 30%, capturing nonlinear relationships and feature interactions that a locality average alone misses.

Honest limitations: the model's error is largest on ultra-luxury rentals (β‚Ή1 lakh+), which are sparse in the data β€” so very high-end flats are predicted less reliably. Locality sparsity was the other big issue: over 1,000 localities appeared only once. I bucketed every locality with fewer than 10 listings β€” counted on the training split only, to avoid leakage β€” into a single "Other" group, cutting the feature space from 1,762 to 145 columns. This trades a little raw accuracy (an earlier 1,762-column model scored ~β‚Ή27,800 RMSE by memorizing one-off localities) for a far more defensible model that generalizes to unseen areas.


How it works

  Raw listings  β†’  Clean & validate  β†’  Explore & test  β†’  Train model  β†’  Serve app
   (CSV, 7.7k)      (pandas)            (scipy stats)      (scikit-learn)   (Streamlit)
  1. Data cleaning β€” parsed messy fields, removed sale-price contamination and outliers, handled missing values. (See DATA_QUALITY.md for every decision.)
  2. Statistical analysis β€” t-tests and ANOVA to identify significant rent drivers.
  3. Modeling β€” train/test split, locality-average baseline, then Linear Regression and Random Forest, compared on held-out data via RMSE.
  4. Deployment β€” a Streamlit app that loads the trained model and returns a fair-rent estimate plus a deal verdict.

Tech stack

Python Β· pandas Β· scikit-learn Β· scipy Β· matplotlib / seaborn Β· Streamlit Β· joblib


Data quality

A core part of this project was handling real, messy data honestly. The original price column was contaminated with sale prices and junk values; I evaluated the data, switched to a cleaner source with a labeled rent field, and documented every cleaning decision. Full details in DATA_QUALITY.md.


Run it yourself

# 1. Clone and enter the repo
git clone https://github.com/Sayan7anDa5/rentradar.git
cd rentradar

# 2. Install dependencies
pip install -r requirements.txt

# 3. Launch the app
streamlit run app.py

The app opens in your browser. Pick a city and locality, set the flat's details, enter an asking rent, and click Check This Deal.


Data layer (PostgreSQL)

Beyond the CSV that powers the app, the dataset is also modeled in a normalized PostgreSQL schema β€” a demonstration of SQL data modeling and querying.

  • Schema (sql/schema.sql): three tables β€” cities β†’ localities β†’ listings β€” with foreign keys, a UNIQUE(name, city_id) constraint (a locality name can recur across cities), and a CHECK on furnishing values.
  • Loader (db/load_to_postgres.py): reads data/rentals_clean.csv and populates the tables in foreign-key order β€” 5 cities, 1,990 locality rows (1,968 distinct names, but 21 recur across cities), and 7,538 listings. Idempotent, safe to re-run.
  • Queries (sql/queries.sql) and a runnable notebook (notebooks/sql_analysis.ipynb): JOIN-based analysis β€” average rent by city, the furnished premium per city, the priciest localities with a reliable sample (HAVING COUNT(*) >= 10), and price-per-sqft leaders per city via a window function.

Setup

# 1. Create the role and database (one time)
sudo -u postgres psql -c "CREATE ROLE rentradar LOGIN PASSWORD 'rentradar';"
sudo -u postgres psql -c "CREATE DATABASE rentradar OWNER rentradar;"

# 2. Configure the connection
cp .env.example .env        # holds DATABASE_URL

# 3. Create the schema and load the data
.venv/bin/python -c "import psycopg2,os; from dotenv import load_dotenv; load_dotenv(); \
c=psycopg2.connect(os.environ['DATABASE_URL']); c.cursor().execute(open('sql/schema.sql').read()); c.commit()"
.venv/bin/python db/load_to_postgres.py

The Streamlit app itself still reads the CSV β€” the Postgres layer is a standalone analytics artifact.


Repository structure

rentradar/
β”œβ”€β”€ README.md
β”œβ”€β”€ DATA_QUALITY.md          # every data-cleaning decision
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ app.py                   # the Streamlit app
β”œβ”€β”€ rentradar.py             # shared helper (locality bucketing)
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ data.csv             # raw source data
β”‚   └── rentals_clean.csv    # cleaned dataset
β”œβ”€β”€ sql/
β”‚   β”œβ”€β”€ schema.sql           # normalized DDL
β”‚   └── queries.sql          # analytical JOIN queries
β”œβ”€β”€ db/
β”‚   └── load_to_postgres.py  # CSV -> Postgres loader
β”œβ”€β”€ models/
β”‚   β”œβ”€β”€ rent_model.pkl       # trained Random Forest
β”‚   β”œβ”€β”€ model_columns.pkl    # feature columns for inference
β”‚   └── known_localities.pkl # localities kept (rest bucketed to "Other")
β”œβ”€β”€ notebooks/
β”‚   β”œβ”€β”€ EDA.ipynb            # exploration & cleaning
β”‚   β”œβ”€β”€ Stats.ipynb          # statistical testing (+ Tukey HSD)
β”‚   β”œβ”€β”€ modeling.ipynb       # model training & evaluation
β”‚   └── sql_analysis.ipynb   # SQL queries over Postgres
└── charts/                  # exported visualizations

Built by Sayantan β€” LinkedIn Β· GitHub

About

🏠 Predict a fair rent for any Indian flat and instantly spot good deals vs. overpriced listings β€” an end-to-end ML data product on 7,500+ real listings across 5 cities. pandas Β· scikit-learn Β· Streamlit Β· PostgreSQL.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors