From 92d68c8b966e0d0b5620fdb367cae8b49cc97620 Mon Sep 17 00:00:00 2001 From: Gigi Cheng <256078623+gigichengnc@users.noreply.github.com> Date: Sat, 22 Aug 2026 17:23:54 +0800 Subject: [PATCH] Freeze Phase 4 prospective sector forecasting protocol --- .../prospective/phase4/ARTIFACT-HASHES.csv | 8 + .../prospective/phase4/FREEZE-PROVENANCE.md | 16 ++ .../phase4/MACRO-SOURCE-MANIFEST.csv | 5 + .../phase4/PHASE4-PROSPECTIVE-CONTRACT.md | 144 ++++++++++++++++++ rebuild/2026/prospective/phase4/README.md | 29 ++++ .../phase4/model_freeze_summary.csv | 11 ++ .../phase4/phase3_reproduction_check.csv | 58 +++++++ .../phase4/prospective_registry.csv | 1 + 8 files changed, 272 insertions(+) create mode 100644 rebuild/2026/prospective/phase4/ARTIFACT-HASHES.csv create mode 100644 rebuild/2026/prospective/phase4/FREEZE-PROVENANCE.md create mode 100644 rebuild/2026/prospective/phase4/MACRO-SOURCE-MANIFEST.csv create mode 100644 rebuild/2026/prospective/phase4/PHASE4-PROSPECTIVE-CONTRACT.md create mode 100644 rebuild/2026/prospective/phase4/README.md create mode 100644 rebuild/2026/prospective/phase4/model_freeze_summary.csv create mode 100644 rebuild/2026/prospective/phase4/phase3_reproduction_check.csv create mode 100644 rebuild/2026/prospective/phase4/prospective_registry.csv diff --git a/rebuild/2026/prospective/phase4/ARTIFACT-HASHES.csv b/rebuild/2026/prospective/phase4/ARTIFACT-HASHES.csv new file mode 100644 index 0000000..136af15 --- /dev/null +++ b/rebuild/2026/prospective/phase4/ARTIFACT-HASHES.csv @@ -0,0 +1,8 @@ +path,bytes,sha256 +FREEZE-PROVENANCE.md,1042,9fcc46d0885b1dee7303e6711e25661203696e5b7e13edd461c4be3f2bd3ef40 +MACRO-SOURCE-MANIFEST.csv,824,0304cd0478794277d37dd10178d1c6bc2ec61aecac202e43cbd7c41d860ecd0e +PHASE4-PROSPECTIVE-CONTRACT.md,7049,f975f841e31077719210fa29c3ed4fe6a3db38df3905c9a864b7c08c53df4b93 +README.md,2421,768d85d1849fabc59fddf7cc204a69e327c2485b897a357841b3200efaf81ec9 +model_freeze_summary.csv,1529,dbe85c009d879ffdd2ce437dc47f07d67f28e1393bc0ccca312abe9267f672c2 +phase3_reproduction_check.csv,3459,7e132cca63ea7bceab64c789b224e131122e2fbf60aaba651c226cb34ca5ef2e +prospective_registry.csv,226,6c8432b6ccee24374871e8f2c32ac28f96a873ca3038a2d3b5c01da3b3535dcb diff --git a/rebuild/2026/prospective/phase4/FREEZE-PROVENANCE.md b/rebuild/2026/prospective/phase4/FREEZE-PROVENANCE.md new file mode 100644 index 0000000..9bbff70 --- /dev/null +++ b/rebuild/2026/prospective/phase4/FREEZE-PROVENANCE.md @@ -0,0 +1,16 @@ +# Phase 4 freeze provenance + +The Phase 4 fixed models were created from the same local 2026 market archive and Phase 3 contract used for the exploratory study. + +- Market archive: `HKSI-RRG-2026-market-data.zip` + - SHA-256: `3838be08d18b238675ea02b9addce983799820abdf74eb40ac0e4ce8481b82bf` +- Phase 3 final pre-run contract: + - SHA-256: `5354e282c7804cd9ee21b28b08298daccbe6c663e63f2093588a325a2b7cc1a3` +- Saved Phase 3 OOS predictions: + - SHA-256: `594dae9f752b1d8b195651a62cb6c9fd23579edda8af7a81e3bf58e238bcd71d` +- Phase 4 macro snapshot through 2026-07: + - SHA-256: `245ee0ac05d3ad045958f46693f89182770db8237ae23a7662c59eaa6bd900af` + +The A/B Phase 3 prediction scores were independently replayed by `build_phase4_freeze.py` and matched the saved OOS scores to less than `1e-12` absolute difference before fixed Phase 4 coefficients were written. + +The Phase 3 RRG-augmented sidecar is not part of the Phase 4 predictive freeze. Its replay differences were numerical and below `2e-6`; it is retained only in the reproduction diagnostic. diff --git a/rebuild/2026/prospective/phase4/MACRO-SOURCE-MANIFEST.csv b/rebuild/2026/prospective/phase4/MACRO-SOURCE-MANIFEST.csv new file mode 100644 index 0000000..bf3c5e3 --- /dev/null +++ b/rebuild/2026/prospective/phase4/MACRO-SOURCE-MANIFEST.csv @@ -0,0 +1,5 @@ +series,description,source,provider,url,latest_month,latest_value,provider_last_updated,retrieved_for_phase4_on +GS10,10-Year Treasury Rate monthly average,Board of Governors of the Federal Reserve System (US),FRED,https://fred.stlouisfed.org/series/GS10,2026-07,4.60,2026-08-03,2026-08-22 +GS2,2-Year Treasury Rate monthly average,Board of Governors of the Federal Reserve System (US),FRED,https://fred.stlouisfed.org/series/GS2,2026-07,4.22,2026-08-03,2026-08-22 +MCOILWTICO,WTI crude oil monthly average,U.S. Energy Information Administration,FRED,https://fred.stlouisfed.org/series/MCOILWTICO,2026-07,80.46,2026-08-05,2026-08-22 +TWEXBGSMTH,Nominal Broad U.S. Dollar Index monthly,Board of Governors of the Federal Reserve System (US),FRED,https://fred.stlouisfed.org/series/TWEXBGSMTH,2026-07,120.5970,2026-08-03,2026-08-22 diff --git a/rebuild/2026/prospective/phase4/PHASE4-PROSPECTIVE-CONTRACT.md b/rebuild/2026/prospective/phase4/PHASE4-PROSPECTIVE-CONTRACT.md new file mode 100644 index 0000000..ca35b7c --- /dev/null +++ b/rebuild/2026/prospective/phase4/PHASE4-PROSPECTIVE-CONTRACT.md @@ -0,0 +1,144 @@ +# Phase 4 prospective sector-forecasting contract + +Frozen on 2026-08-22, before the first official prospective decision week. + +## Purpose + +Phase 3 produced exploratory evidence that lagged macro regimes, interacted with sector identity, may improve cross-sectional forecasts of fully future sector returns relative to SPY. Phase 4 is the prospective confirmation layer. It is designed to test that hypothesis on decisions that occur only after this contract and the model coefficients are frozen. + +No Phase 4 observation before the freeze date can count as prospective evidence. + +## Candidate and baseline + +The candidate is the Phase 3 `price_macro_interactions` specification: + +- Phase 2 price and market-regime features +- sector fixed effects +- sector-by-macro interactions +- `StandardScaler` +- `LogisticRegression(C=1.0, L2)` + +The baseline is `price_sector_fe`, which keeps the same price/regime features and sector fixed effects but excludes the macro-interaction block. + +Both candidate and baseline are frozen for 1, 2, 4, 8 and 12 week horizons. + +RRG-style variables are not part of the Phase 4 primary predictive model. Phase 3 did not show robust incremental RRG value after macro interactions. RRG may remain a descriptive or visualization layer, but it cannot be credited as the predictive engine unless a separate future study establishes that claim. + +## Target + +For sector `s`, decision week `t`, and horizon `h`: + +`future_relative_return = log(P_s[t+h] / P_s[t]) - log(P_SPY[t+h] / P_SPY[t])` + +The binary model target is whether this fully future relative return is greater than zero. The ranking metrics use the continuous future relative return. + +## Frozen training boundary + +All fitted coefficients use only discovery/development rows whose target ends on or before 2025-08-15. + +The final frozen fits use all eligible Phase 3 development rows for each horizon, with the same feature construction and common-week eligibility used in Phase 3. The Phase 3 out-of-sample prediction file was numerically replayed before the Phase 4 freeze. Candidate and baseline scores match the saved Phase 3 scores to floating-point precision. + +No Phase 4 model is refit, retuned, replaced, horizon-selected, or feature-selected during the confirmation window. + +## First prospective decision + +The first official prospective decision week is **2026-08-28**. + +The 2026-08-21 week is excluded because this contract and the final coefficient freeze occurred after that market week had closed. The 2026-08-14 dry run is a pipeline smoke test only and is never eligible for prospective scoring. + +An official decision is recorded only after the Friday U.S. market close and only when all 12 price series have a completed observation for that Friday. A Friday market holiday requires an explicit protocol amendment before using a prior trading session. + +## Information available at a decision + +### Market inputs + +A decision may use only the market-data snapshot retrieved after that week's close. The raw provider payload and processed panel should be archived and hashed. Historical provider restatements must not silently replace the snapshot used to create the prediction. + +### Macro inputs + +For a decision in calendar month `M`, the newest macro month permitted is `M-1`. + +The macro block remains: + +- 10-year Treasury yield level +- 2-year Treasury yield level +- 10y minus 2y curve slope +- 3-month change in 10-year yield +- 3-month change in 2-year yield +- 3-month change in curve slope +- 3-month and 12-month WTI log return +- 3-month and 12-month broad-dollar log return + +Each weekly macro snapshot is archived and hashed because FRED histories can be revised. + +## Immutable prediction ledger + +Every official weekly run records, before any target outcome is known: + +- prediction creation timestamp +- decision week +- market snapshot hash +- macro snapshot hash +- frozen model hash +- model name and horizon +- sector +- score and within-week rank +- target maturity date + +An existing prediction key `(decision_week, model, horizon, sector)` is never overwritten. Corrections require a new record with an explicit correction status and reason; the original remains preserved. + +Outcome fields stay blank until the horizon matures. + +## Outcome snapshot rule + +At target maturity, compute the return from a newly archived maturity-date market snapshot, using both endpoint adjusted prices from that same maturity snapshot. This prevents later corporate-action restatements from silently rewriting the scored outcome. The maturity snapshot and outcome calculation are hashed and retained. + +## Primary confirmatory endpoint + +The preselected primary horizon is **4 weeks**. It is selected for prospective confirmation after Phase 3 discovery and is not an untouched historical choice. + +Primary comparison: + +`delta_rank_IC = weekly_rank_IC(candidate) - weekly_rank_IC(baseline)` + +Primary claim bar after at least 52 official weekly decisions and after their 4-week outcomes have matured: + +1. candidate 4-week mean weekly Spearman rank IC is positive with a 95% moving-block bootstrap interval whose lower bound is above zero; and +2. candidate-minus-baseline 4-week rank-IC improvement is positive with a 95% paired moving-block bootstrap interval whose lower bound is above zero. + +The bootstrap resamples complete decision weeks with block length 4 or longer. + +If this bar is not met, Phase 3's macro-sector result is not prospectively confirmed, even if another horizon looks attractive after the fact. + +## Secondary endpoints + +Always report all pre-frozen horizons: 1, 2, 4, 8 and 12 weeks. + +Secondary metrics: + +- mean weekly Spearman rank IC +- mean weekly top-3 minus bottom-3 future relative-return spread +- candidate-minus-baseline paired differences +- pooled ROC AUC +- balanced accuracy + +Secondary horizons can describe generalization but cannot rescue a failed 4-week primary endpoint without a separately registered future study. + +## Timing and interim views + +- Minimum confirmatory sample: 52 official weekly decisions. +- Primary 4-week evaluation occurs only after all 52 primary outcomes mature. +- Full 12-week secondary evaluation waits until the corresponding outcomes mature. +- Interim tables may be inspected for pipeline health, but they remain descriptive and do not trigger model changes. + +## No trading claim yet + +Phase 4 tests predictive ranking, not profitability. No new portfolio rule, execution rule, transaction-cost optimization, or investable claim is introduced during the confirmation window. Economic-value research starts only after the predictive endpoint is evaluated. + +## Interpretation rule + +Before prospective confirmation, the strongest allowed wording remains: + +> Exploratory development evidence suggests that lagged macro regimes may improve cross-sectional sector ranking. A genuine forward-looking edge has not yet been confirmed. + +A successful Phase 4 primary endpoint would support a narrower claim of prospective 4-week sector-ranking evidence. It would still not establish exact price prediction or guaranteed trading alpha. diff --git a/rebuild/2026/prospective/phase4/README.md b/rebuild/2026/prospective/phase4/README.md new file mode 100644 index 0000000..07ba290 --- /dev/null +++ b/rebuild/2026/prospective/phase4/README.md @@ -0,0 +1,29 @@ +# Phase 4 prospective sector-forecasting freeze + +This directory publicly timestamps the prospective-confirmation design that follows the v0.2 structural-null correction and the Phase 3 exploratory macro-regime study. + +The purpose of this freeze is **not** to publish a new predictive claim. It records the research contract, training boundaries, model/hash commitments, provenance, reproduction gate, and empty prospective-ledger schema before the first eligible official prediction week. + +First official prospective decision: **2026-08-28**. + +No Phase 4 prediction or matured outcome is included in this freeze commit. + +## Public freeze record + +- `PHASE4-PROSPECTIVE-CONTRACT.md`: target, frozen A/B specifications, primary endpoint, timing, and interpretation rules. +- `FREEZE-PROVENANCE.md`: hashes linking the freeze to the development archive, Phase 3 contract, replay reference, and macro snapshot. +- `model_freeze_summary.csv`: training boundaries, feature counts, and SHA-256 commitments for each fixed model file. +- `phase3_reproduction_check.csv`: numerical replay gate completed before the Phase 4 freeze. +- `MACRO-SOURCE-MANIFEST.csv`: source metadata for the macro snapshot available at freeze time. +- `prospective_registry.csv`: empty immutable-ledger schema; it contains no prospective predictions at freeze time. +- `ARTIFACT-HASHES.csv`: hashes for the public freeze files themselves. + +The coefficient JSON files and market-data archive are not published in this timestamp PR. Their SHA-256 commitments are recorded here before the first official prospective decision. Any later coefficient file used for Phase 4 must match the committed hash exactly; otherwise it is a different model and cannot inherit the prospective claim. + +## Research boundary + +The fixed `price_macro_interactions` candidate is compared with the fixed `price_sector_fe` baseline. RRG-style variables are not credited as the Phase 4 predictive engine because Phase 3 did not establish robust incremental value after the macro-interaction block. + +The preselected primary horizon is 4 weeks. The minimum confirmatory sample is 52 official weekly decisions, evaluated only after all corresponding 4-week outcomes have matured. + +Until that test is complete, the strongest allowed wording remains exploratory: lagged macro regimes may improve cross-sectional sector ranking, but a genuine forward-looking edge has not yet been confirmed. diff --git a/rebuild/2026/prospective/phase4/model_freeze_summary.csv b/rebuild/2026/prospective/phase4/model_freeze_summary.csv new file mode 100644 index 0000000..d9073e3 --- /dev/null +++ b/rebuild/2026/prospective/phase4/model_freeze_summary.csv @@ -0,0 +1,11 @@ +model,horizon,training_rows,training_weeks,first_decision,last_decision,positive_rate,feature_count,model_sha256 +price_sector_fe,1,2662,242,2020-12-25,2025-08-08,0.49474079639368895,33,eaa6333b3d31c66df829ec652544d4a7b34166209e3f9dfe71e82651f6ffff03 +price_macro_interactions,1,2662,242,2020-12-25,2025-08-08,0.49474079639368895,143,99269fc2a061976d7bf689aa363a0c86b038b6b60437bc60a09865adac8bcabf +price_sector_fe,2,2651,241,2020-12-25,2025-08-01,0.48019615239532254,33,f975dc43e8fb205e3797f5107121d024494c112a8cb1d5e39984c032f3e27511 +price_macro_interactions,2,2651,241,2020-12-25,2025-08-01,0.48019615239532254,143,6cac42ee2af0c99277519f583899bc850fef60601e5f4a6437dbc3d69ba5baba +price_sector_fe,4,2629,239,2020-12-25,2025-07-18,0.47394446557626474,33,9e4a307e8f6e1c7da3fa262014846cf278cff81eb39f93cfc0db70344ef34b98 +price_macro_interactions,4,2629,239,2020-12-25,2025-07-18,0.47394446557626474,143,dcd445c7c8316f95dc6e6cffd20b73e69678b3de0a8cf7deb779682a5de5ae7b +price_sector_fe,8,2585,235,2020-12-25,2025-06-20,0.4626692456479691,33,b073c726bb019067a2a62a743aebccd47126ee150119c7174060b1f82ecd76f2 +price_macro_interactions,8,2585,235,2020-12-25,2025-06-20,0.4626692456479691,143,9eeb5d5bafb5964be70aa3bf0c84dbc03484c29ab3c65f015f66e41289aba5e8 +price_sector_fe,12,2541,231,2020-12-25,2025-05-23,0.452577725304998,33,8670fb3471aafe3dc02c4c153d8872808d323bb5ddf2217ae2303f85f82b3885 +price_macro_interactions,12,2541,231,2020-12-25,2025-05-23,0.452577725304998,143,6e08f532e9d003c9119bda46777b88c3b2019e08480807e4d5f6ef833a660c3e diff --git a/rebuild/2026/prospective/phase4/phase3_reproduction_check.csv b/rebuild/2026/prospective/phase4/phase3_reproduction_check.csv new file mode 100644 index 0000000..ebb8449 --- /dev/null +++ b/rebuild/2026/prospective/phase4/phase3_reproduction_check.csv @@ -0,0 +1,58 @@ +horizon,fold,model,rows,max_abs_score_diff,exact_numeric_match_1e-12,phase4_gate_pass +1,1,price_sector_fe,286,5.551115123125783e-17,True,True +1,1,price_macro_interactions,286,1.1102230246251565e-16,True,True +1,1,price_macro_rrg,286,7.908818044910504e-11,False,True +1,2,price_sector_fe,286,5.551115123125783e-17,True,True +1,2,price_macro_interactions,286,9.71445146547012e-17,True,True +1,2,price_macro_rrg,286,5.78181946764289e-12,False,True +1,3,price_sector_fe,286,5.551115123125783e-17,True,True +1,3,price_macro_interactions,286,9.71445146547012e-17,True,True +1,3,price_macro_rrg,286,1.1958933843203567e-11,False,True +1,4,price_sector_fe,88,5.551115123125783e-17,True,True +1,4,price_macro_interactions,88,5.551115123125783e-17,True,True +1,4,price_macro_rrg,88,7.988054662178001e-13,True,True +2,1,price_sector_fe,286,5.551115123125783e-17,True,True +2,1,price_macro_interactions,286,1.1102230246251565e-16,True,True +2,1,price_macro_rrg,286,9.404743650520686e-11,False,True +2,2,price_sector_fe,286,5.551115123125783e-17,True,True +2,2,price_macro_interactions,286,8.326672684688674e-17,True,True +2,2,price_macro_rrg,286,6.177280909014371e-13,True,True +2,3,price_sector_fe,286,5.551115123125783e-17,True,True +2,3,price_macro_interactions,286,1.1102230246251565e-16,True,True +2,3,price_macro_rrg,286,7.384093336781916e-13,True,True +2,4,price_sector_fe,77,5.551115123125783e-17,True,True +2,4,price_macro_interactions,77,1.1102230246251565e-16,True,True +2,4,price_macro_rrg,77,3.927969061123804e-13,True,True +4,1,price_sector_fe,286,5.551115123125783e-17,True,True +4,1,price_macro_interactions,286,1.1102230246251565e-16,True,True +4,1,price_macro_rrg,286,3.3069103011484913e-12,False,True +4,2,price_sector_fe,286,5.551115123125783e-17,True,True +4,2,price_macro_interactions,286,1.1102230246251565e-16,True,True +4,2,price_macro_rrg,286,1.694293028098315e-08,False,True +4,3,price_sector_fe,286,5.551115123125783e-17,True,True +4,3,price_macro_interactions,286,1.1102230246251565e-16,True,True +4,3,price_macro_rrg,286,1.296639462466942e-10,False,True +4,4,price_sector_fe,55,5.551115123125783e-17,True,True +4,4,price_macro_interactions,55,1.1102230246251565e-16,True,True +4,4,price_macro_rrg,55,1.2687207395778444e-09,False,True +8,1,price_sector_fe,286,5.551115123125783e-17,True,True +8,1,price_macro_interactions,286,1.1102230246251565e-16,True,True +8,1,price_macro_rrg,286,8.455705202692343e-08,False,True +8,2,price_sector_fe,286,8.326672684688674e-17,True,True +8,2,price_macro_interactions,286,1.1102230246251565e-16,True,True +8,2,price_macro_rrg,286,2.598960491262403e-09,False,True +8,3,price_sector_fe,286,8.326672684688674e-17,True,True +8,3,price_macro_interactions,286,1.1102230246251565e-16,True,True +8,3,price_macro_rrg,286,1.1577150638153455e-06,False,True +8,4,price_sector_fe,11,0.0,True,True +8,4,price_macro_interactions,11,8.326672684688674e-17,True,True +8,4,price_macro_rrg,11,1.2176405439490168e-09,False,True +12,1,price_sector_fe,286,8.326672684688674e-17,True,True +12,1,price_macro_interactions,286,1.1102230246251565e-16,True,True +12,1,price_macro_rrg,286,2.1343360412373613e-10,False,True +12,2,price_sector_fe,286,8.326672684688674e-17,True,True +12,2,price_macro_interactions,286,1.1102230246251565e-16,True,True +12,2,price_macro_rrg,286,2.984289870777701e-09,False,True +12,3,price_sector_fe,253,8.326672684688674e-17,True,True +12,3,price_macro_interactions,253,1.1102230246251565e-16,True,True +12,3,price_macro_rrg,253,1.58552004858592e-10,False,True diff --git a/rebuild/2026/prospective/phase4/prospective_registry.csv b/rebuild/2026/prospective/phase4/prospective_registry.csv new file mode 100644 index 0000000..619f4b3 --- /dev/null +++ b/rebuild/2026/prospective/phase4/prospective_registry.csv @@ -0,0 +1 @@ +prediction_created_at_utc,decision_week,source_market_snapshot_sha256,source_macro_snapshot_sha256,model_sha256,model,horizon_weeks,symbol,score,rank,target_date,future_relative_log_return,outcome_matured_at_utc,record_status