Machine Learning–driven Real Estate Management System focused on the Nigerian property market (starting with Lagos rent data). The goal is to improve transparency and pricing accuracy by:
- Cleaning and structuring fragmented listing data
- Predicting likely annual rent (₦) from property attributes
- Laying foundations for recommendation, trend analysis & geospatial insights
- Training script (
train.py) trains Linear Regression, RandomForest, optionally XGBoost and auto-selects the best (RMSE) - Persisted best model (
models/best_model.joblib) + metrics JSON (artifacts/metrics.json) - Streamlit app (
streamlit_app.py) for interactive rent prediction - Config centralization (
config.py) keeping features & paths consistent - Basic test (
tests/test_training.py) to ensure training produces artifacts
- Property recommendation engine (content + hybrid)
- Market trend time-series module (price evolution by location)
- Geospatial enrichment (lat/long, distance to POIs, clustering)
- Explainability (SHAP values, feature importance visualization)
- Data versioning & experiment tracking (DVC / MLflow)
- Scheduled retraining workflow (GitHub Actions cron)
- Deployment (Streamlit Cloud / Render) + API endpoints
- Drift monitoring & simple analytics dashboard
Install dependencies (ideally in a virtual environment):
pip install -r requirements.txtpython train.py --data lagos-rent.csv --test-size 0.2 --skip-xgb # skip-xgb if environment lacks xgboostArtifacts:
models/best_model.joblibartifacts/metrics.json
streamlit run streamlit_app.pyuvicorn api_app:app --reload --port 8000Then test:
curl -X POST http://127.0.0.1:8000/predict \
-H 'Content-Type: application/json' \
-d '{
"bedrooms":3,
"bathrooms":3,
"toilets":4,
"Serviced":1,
"Newly_Built":1,
"Furnished":0,
"property_type":"Apartment",
"City":"Lagos",
"Neighborhood":"Lekki"
}'Swagger UI: http://127.0.0.1:8000/docs
Prometheus Metrics (if enabled): http://127.0.0.1:8000/metrics
Feature Importance (if available): http://127.0.0.1:8000/model/feature_importance
make train # quick training
make api # run API with reload
make streamlit # run Streamlit UI
make test # run test suite
make docker-build && make docker-rundocker build -t naijaestateai:latest .
docker run -p 8000:8000 naijaestateai:latestConfigure via .env or environment variables:
LOG_LEVEL=info
ENABLE_METRICS=true
MODEL_VERSION=1.0.0
Simple static HTML page is in static/index.html (served if you put behind a web server or mount). For local dev you can open it and point fetch calls to the API origin if different.
A React/Next.js client lives in frontend/.
Install & run (in separate shell):
cd frontend
npm install # or yarn / pnpm
npm run devIt defaults to calling http://localhost:8000 for the API. Override:
export NEXT_PUBLIC_API_BASE="https://your-api-host"
npm run devProduction build:
npm run build && npm startThe page provides a form for predictions and a cURL snippet generator.
pytest -qRaw Lagos rent dataset columns are parsed into engineered features:
- Numerical: bedrooms, bathrooms, toilets
- Binary: Serviced, Newly Built, Furnished
- Categorical: property_type (inferred), City, Neighborhood
Target: annual rent price (₦) converted to numeric (price_ngn).
Open an issue / PR with improvements (e.g., better feature extraction, additional data sources, or deployment scripts).
MIT (add LICENSE file if required).