- Done:
- Bigger data (decision 0009): 28 more retailers in
config/retailers.csvand their Wikipedia titles inconfig/wiki_articles.csv, giving 38 retailers + SPY.- Every ticker was checked before it was added: all 2,514 trading days on Yahoo, and Wikipedia views in every month of 2016–2025.
- Williams-Sonoma, Casey’s and Burlington were renamed on Wikipedia, so both titles are listed and their views added together. Boot Barn was left out, since it had no article before 2021.
- The ETL was re-run:
clean/prices.parquetandclean/master.parquetnow have 98,046 rows (was 27,654).
- Machine learning (decision 0007):
src/ml/features.py: one feature builder shared by training and live scoring.src/ml/train.py: Spark MLlib. Logistic regression and gradient-boosted trees on the stream’s daily output, with a purged time split (train 2016–2022, choose on 2023, test 2024–2025), class weights, an attention ablation and a no-model baseline.src/streaming/job.pynow loads the saved model and writesdata/stream/predictions/each micro-batch (scoring runs in the JVM).
- Live dashboard (decision 0008):
src/dashboard/app.py(Streamlit,streamlit run src/dashboard/app.py). It shows today’s alerts, tomorrow’s watchlist, event CARs as windows close, and charts. It reads only finished micro-batches. run_everything.shnow also runs the batch study (car.py,stats.py,charts.py), the stream-vs-batch comparison and the model (--skip-mlskips it), then prints how to open the dashboard. Kafka mode uses--max-per-trigger 390(10 days × 39 tickers).- Docs:
- four new contracts (
stream_predictions,ml_metrics,ml_test_predictions,ml_feature_importance), indocs/data-contracts.mdandcontracts.py; common.studyML settings andcommon.settingsmodel paths;- README “For markers” and run steps, and AGENTS.md layout;
- architecture diagrams updated to the new numbers, plus pair 11 (model and dashboard).
- four new contracts (
- Tests:
tests/test_ml_features.py(7) andtests/test_dashboard.py(3, including a headless run of the app). 115 pass.
- Bigger data (decision 0009): 28 more retailers in
- Results:
- Scale: the local streaming run matches the direct computation on 95,190 stock-days and 2,280 event CARs (largest difference about 2e-16, 0 rows dropped). The comparison with the answer key gives 2,280 of 2,280 windows equal, and the same significance call in 2,242 of 2,242.
- Batch study at 38 retailers:
- store retailers’ mean CAR over all events is +1.1% (clustered p = 0.033);
- Halloween online −3.6% (p = 0.044), and online minus store −4.5% (p = 0.02);
- Black Friday stores +2.5% (p = 0.094).
- Model (test years 2024–2025, 18,696 stock-days, base rate 5.2%):
- gradient-boosted trees: ROC-AUC 0.688, PR-AUC 0.135, and 21.5% of its top 5% flags are big moves (4.1× lift);
- the no-model baseline (today’s |z_ar|): 0.582 and 2.4×;
- without the attention features the score is the same, so Wikipedia attention adds nothing to this model;
- the top features are month, log volume ratio, the market’s absolute move, ar_sd, and days to or since an event.
- Training takes about 1 minute locally. A full
run_everything.sh --skip-etltakes about 20 minutes at 38 retailers.
- Decisions: 0007 (big-move model), 0008 (dashboard), 0009 (38 retailers), all Proposed.
- Contracts:
stream_predictions,ml_metrics,ml_test_predictions,ml_feature_importanceadded. Existing contracts are unchanged. - Next:
- Review and merge the branch into
main(AGENTS.md rule 6). - Re-run the cluster test at 38 retailers, and train the model there (a Spark 4 model may not load in the cluster’s Spark 3.5).
- Use the dashboard in the demo video.
- Review and merge the branch into
- Blocked on / needs from others:
- Anushiya: please review the
run_everything.shchanges (steps 7–9; this covers the pending #11 update). - Areej: the batch numbers changed with 38 retailers, so re-run
car.py,stats.pyandcharts.pybefore writing the results. Decision 0009 lists the new findings. - Sanchi: the results section can use the model table above,
data/results/charts/ml_roc_pr.pngandml_feature_importance.png. - Everyone: run
pip install -r requirements.txtagain forstreamlit. Agree on decisions 0007–0009, or say what to change.
- Anushiya: please review the
Handoffs, newest first