. ├── data_fetcher.py ├── preprocessing.ipynb ├── model_training.ipynb ├── data.zip
data_fetcher.py downloads satellite imagery for each property using latitude and longitude coordinates and saves them locally. Images are fetched from the Mapbox Static API using an access token provided inside the script.
- Skips images that have already been successfully downloaded
- Re-downloads only images marked as “bad”
- Handles missing coordinate records gracefully
- Organizes image outputs into individual folders
Images are stored in:
train_img/test_img/
The script expects train.csv and test.csv to be present. If corrupted images are found later, their IDs can be added to:
bad_train_image_ids.csvbad_test_image_ids.csv
and the script will overwrite them on the next run.
Notebook: preprocessing.ipynb
This notebook focuses on understanding the dataset rather than training models. It primarily contains visual exploration and discussion.
- Initial dataset inspection
- Missing data exploration
- Distribution plots for key numerical features
- Correlation matrices
- Pair plots examining feature relationships
- Geographic maps and spatial insights
- Outlier identification and justification for retaining them
Note on Outliers: Outliers are intentionally not removed because many represent real luxury homes and carry meaningful information about the market rather than being noise.
Notebook: model_training.ipynb
This notebook implements the end-to-end modeling workflow.
- Merge structured tabular data with extracted image features
- Standardize numerical features where appropriate
- Apply Principal Component Analysis (PCA) to image feature matrices
- Train XGBoost regression models
- Tune hyperparameters using RandomizedSearchCV
- Evaluate performance on validation data
- Use interpretability methods including feature importance plots, SHAP visualizations, and Grad-CAM overlays
Image-derived feature sets tend to be extremely high dimensional and often contain redundant information. PCA is applied to:
- Reduce dimensionality
- Minimize multicollinearity
- Improve model generalization
- Lower computational cost
- Reduce risk of overfitting
- Preserve most of the signal while removing noise
Only components explaining most of the variance are retained during training.
-
Extract the dataset archive:
unzip data.zip -
Download satellite images for train and test rows:
python data_fetcher.py -
Open and run the exploratory notebook:
preprocessing.ipynb -
Train and analyze models in:
model_training.ipynb
Some IDs appear multiple times with different dates. The same image is used for all occurrences belonging to that ID. This simplifies processing while keeping meaningful location information intact.
- Outliers remain in the dataset intentionally.
- Geographic information has a large influence on price.
- PCA is applied to stabilize and compress image features.
- RandomizedSearchCV helps reduce hyperparameter tuning time.
- SHAP and Grad-CAM support transparency and explainability.
Force plots not rendering in SHAP
import shap
shap.initjs()Trust the notebook if prompted.
Missing or failed images
This project demonstrates how structured features, geospatial imagery, dimensionality reduction, and modern machine-learning models can be combined to predict property values efficiently and transparently. Each file is structured to separate exploration, preprocessing, and modeling so that results remain easy to follow and reproduce.