This repository includes an application stack plus a scaffolded machine learning workspace for data preparation, feature engineering, modeling, evaluation, and integration.
The entire ML workspace now lives under the ml/ umbrella folder so it stays separate from the frontend, backend, and course documentation at the repo root.
ml/data/: raw, interim, processed, and external datasetsml/docs/: ML planning, inventories, joins, and feature documentationml/ml-pipelines/: notebook-based exploratory and pipeline-specific analysisml/src/: reusable Python modules for data, features, modeling, and inferenceml/models/: saved artifacts and metricsml/reports/: generated figures, tables, and evaluation outputsml/tests/: validation for core ML functionalityml/scripts/: CLI entry points for orchestrationml/app-integration/: example API wiring and payload references
- Finalize threshold choices and calibration policy per predictive pipeline using the Phase 4 reports.
- Expand the explanation-first branches for campaign effectiveness and intervention effectiveness.
- Execute the notebook templates top to bottom and add narrative interpretation for the final submission.
- Decide whether the nightly retrain should also refresh notebook artifacts or only API-facing prediction outputs.
Train one predictive pipeline:
py -3 ml/scripts/train_one.py donor_retentionTrain all implemented predictive pipelines and write a summary report:
py -3 ml/scripts/run_all_pipelines.pyGenerate shared cross-validation and calibration reports for the implemented predictive pipelines:
py -3 ml/scripts/run_phase4_modeling_framework.pyRefresh notebook deliverables:
py -3 ml/scripts/build_phase5_notebooks.pyRun the Phase B notebook-standardization pass and regenerate the shared notebook factory outputs:
py -3 ml/scripts/run_phase_b_notebook_standardization.pyExport API payload examples and manifests:
py -3 ml/scripts/export_for_api.pyScore a CSV in batch mode:
py -3 ml/scripts/score_batch.py donor_retention --input some_file.csvRun the donor and outreach expansion pass, including the shared donor snapshot table, the fast Phase C predictive pipelines, and refreshed notebook deliverables:
py -3 ml/scripts/run_phase_c_donor_outreach.pyRun the resident expansion pass, including the refreshed resident-month snapshot table, the new Phase D predictive pipelines, and regenerated notebook deliverables:
py -3 ml/scripts/run_phase_d_resident_expansion.pyRun the strategic and leadership expansion pass, including the shared safehouse-month table, the parsed public-impact series, the new Phase E predictive pipelines, and regenerated notebook deliverables:
py -3 ml/scripts/run_phase_e_strategic_expansion.pyRun the packaging and app-integration pass, including regenerated payload examples, refreshed manifests, the Phase F API contract matrix, and the packaging report:
py -3 ml/scripts/run_phase_f_packaging_integration.pyRun the full nightly-style ML refresh locally without writing back to Supabase:
py -3 ml/scripts/refresh_supabase_ml.py --dry-runRun the full refresh and publish the latest predictions back to Supabase:
py -3 ml/scripts/refresh_supabase_ml.py- Frontend ML surfaces now read from backend
/ml/...endpoints rather than talking to Supabase directly. - The nightly GitHub Actions workflow lives at
.github/workflows/ml-nightly-retrain.yml. - Local ML Supabase settings can be scaffolded from
ml/.env.example. - GitHub Actions uses UTC. The current cron
0 8 * * *runs at2:00 AMin Denver during daylight saving time and1:00 AMduring standard time. - Use a direct Supabase Postgres connection on port
5432for the workflow secret when possible. If you stay on the pooler port6543, runbackend/docs/ml-refresh-ddl-supabase.sqlonce in the Supabase SQL Editor first.