This project trains and compares machine learning models for predicting Myntra product prices in INR from product metadata such as brand, gender category, image count, primary color, and description text.
main.py- runs the full training pipeline.src/- data loading, feature engineering, preprocessing, model training, evaluation, reporting, and artifact utilities.app/app.py- Streamlit app for interactive price prediction.data/raw/myntra_products_catalog.csv- source dataset.data/test/app_test_products.txt- small app test set with real product prices for quick validation.models/- trained model artifacts.artifacts/preprocessor.pkl- fitted preprocessing pipeline.reports/- metrics and training report.notebooks/- exploratory and phase-based project notebooks.
From the project root:
cd C:\Users\Arman\Desktop\ml_project
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txtIf PowerShell blocks activation in the current session:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
.\.venv\Scripts\Activate.ps1Use the virtual environment Python explicitly:
.\.venv\Scripts\python.exe main.pyThe pipeline:
- loads
data/raw/myntra_products_catalog.csv - engineers text and color features
- applies target encoding, one-hot encoding, and numeric scaling
- trains KNN, SVM, RandomForest, HistogramGradientBoosting, MLP, and TensorFlow deep regressor models
- saves models to
models/ - saves the fitted preprocessor to
artifacts/preprocessor.pkl - writes metrics to
reports/test_metrics.csv - writes the full report to
reports/training_report.json
.\.venv\Scripts\python.exe -m streamlit run app/app.pyThe app reads the latest training report and only shows models that have matching saved artifacts. It supports both .pkl scikit-learn models and the .keras TensorFlow model.
After each prediction, the app also shows a compact real-price comparison using the closest matching product group from the source dataset, including INR difference and percentage error.
Use the Test Example dropdown to load a saved product from data/test/app_test_products.txt. After clicking Predict Price, the app compares the prediction against that product's real price.
.\.venv\Scripts\python.exe -m src.visualizationThis creates report images in imgs/, including eda_price_plots.png, log_price_by_gender.png, baseline_models_r2.png, and baseline_vs_deep_learning.png.
Latest test metrics from reports/test_metrics.csv:
| Model | MAE | RMSE | R2 |
|---|---|---|---|
| RandomForest | 0.2597 | 0.3749 | 0.7181 |
| HistogramGradientBoosting | 0.2650 | 0.3776 | 0.7141 |
| TensorFlowDeepRegressor | 0.2819 | 0.3945 | 0.6879 |
| MLP | 0.2937 | 0.4072 | 0.6674 |
| SVM | 0.2929 | 0.4109 | 0.6614 |
| KNN | 0.2927 | 0.4194 | 0.6472 |
The current best model is RandomForest.
- The target is modeled as
log1p(Price (INR)); app predictions are converted back withexpm1. - TensorFlow may print oneDNN/CPU optimization messages during startup. These are informational messages, not failures.
- Run notebooks from the
notebooks/directory or project root after installing dependencies. They import project code through thesrcpackage.