This expands on the README's Setup section with more detail on what each step actually generates, plus the CLI predictor as an alternative to the dashboard.
- Python 3.10+
- pip
git clone https://github.com/adarsh-yadav1/Niyantrak.git
cd Niyantrakpip install -r requirements.txtWindows users: requirements.txt includes Jupyter-related packages (jupyter_server_terminals, terminado) that depend on pywinpty. On Windows, pywinpty sometimes fails to resolve automatically through the bulk requirements.txt install. If you hit an error related to pywinpty during or after this step, run:
pip install pywinpty==3.0.3Then re-run pip install -r requirements.txt to pick up anything that failed to install before pywinpty was resolved. This step is not needed on macOS or Linux — pywinpty is a Windows-only package and pip will simply skip it on other platforms.
python train_all.pyThis single command runs the full pipeline end to end. What it actually does, in order:
- Loads and cleans
data.csv(src/preprocessing/load_data.py,clean.py) - Builds the corridor-hour time-series dataset (
src/forecasting/build_timeseries_dataset.py) - Builds the spatial-cluster-hour time-series dataset (
src/forecasting/build_spatial_timeseries_dataset.py) - Trains the corridor-hour hurdle model — classifier + regressor (
train_timeseries_model.py) →models/timeseries_forecast_model.pkl,models/timeseries_forecast.pkl - Trains the spatial-cluster-hour hurdle model — the primary forecasting tier (
train_spatial_timeseries_model.py) →models/spatial_timeseries_forecast_model.pkl - Builds the coordinate-aware feature store, including spatial clustering (
src/inference/feature_store.py) →models/traffic_feature_store.pkl - Runs the cluster fallback ablation study (
src/evaluation/cluster_fallback_ablation.py) →models/cluster_fallback_ablation.json - Trains the quantile interval models for the 80% prediction interval (
train_quantile_intervals.py) - Runs EIS weight calibration (
src/evaluation/eis_weight_calibration.py) →models/eis_weight_calibration.json,EIS_WEIGHT_CALIBRATION.md - Generates a feature importance plot →
forecast_feature_importance.png
See Generated Model Artifacts in the README for the full file list this produces.
python manage.py runserverOpen the local server URL printed in the terminal (typically http://127.0.0.1:8000/) to use the map-based dashboard.
python scripts/predict.pyUseful for a quick CLI-based prediction without starting the web dashboard — for example, to sanity-check a single coordinate and event combination during development.
If you only need to rebuild the feature store (for example, after editing data.csv without retraining the forecasting models), you can run it independently:
python scripts/prepare_feature_store.pyTo retrain only the primary spatial-cluster model without re-running the entire pipeline:
python scripts/train_spatial_model.pyA rolling-window retraining script exists for periodically refreshing the models without re-running the full pipeline manually each time:
python scripts/retrain_30_days.pyThis is not currently triggered automatically — see Feedback & Retraining for its current scope and what it would take to make this a fully automated loop.
- Architecture — what each pipeline stage does conceptually
- Limitations & Roadmap — what's intentionally out of scope for now