SniperGold_ML/docs/P3_S17_DATASET_AUDIT_LABEL_VALIDATION.md

9 KiB

P3-S.17 DATASET AUDIT / LABEL VALIDATION — SNIPERGOLD_ML

Date       : 2026-08-23
Session    : P3-S.17 — Dataset Audit / Label Validation
Status     : AUDIT COMPLETE -> VERDICT = DATASET BLOCKED (real-data population
             is EMPTY under the migrated proxy semantics; see §A/§B).
Baseline   : P3-S.16 checkpoint 4b095443077539889f0ac6f0381881d6e4995c73
             VERIFIED (local == origin/main, branch main, working tree CLEAN).
Scope      : XAUUSD M15 2017-01-01..2026-08-20 (Files\\AlgoForge\\Data),
             frozen P3-S.16 dataset/label contract.
Human verif: REMAINS CANCELLED (historical only). NO AUC/PF/backtest used.
Decision   : DATASET BLOCKED — see §B (two blockers).

A. SESSION OBJECTIVE

Answer (P3-S.17):

Does the frozen Candidate Setup + P3-S.16 label contract produce a real, deterministic, causally valid, reproducible training population on historical data, without reintroducing the overlap / look-ahead / label-misalignment problems of the legacy bar-level pipeline?


B. VERDICT — DATASET BLOCKED

Two independent blockers were found:

BLOCKER 1 — EMPTY REAL-DATA POPULATION (primary):
  The real-data Candidate Setup population is 0 observations across the
  authorized XAUUSD M15 window (~194,985 bars). The frozen F3 chain did not
  complete at any bar under the migrated real-data SMC semantics. Root-cause
  primitive counts (§D) show the proxy sweep detection (84 onsets) and the
  zone-unmitigated detection (69 bars) are far more selective than the frozen
  runtime's F1/F2 detectors. The P3-S.16 contract MECHANICS are validated and
  deterministic (unit tests 20/20, no leakage), but a real training population
  cannot be built yet.

  This must be resolved by RECONCILING the real-data SMC extraction with the
  frozen MQL5 F3/F1/F2 detectors (AF_Engine2_Setup / AF_DetectSweep /
  AF_DetectChoch / AF_FindFVG / AF_FindOrderBlock, closed-bar Engine-1 cache).
  It is a FUTURE INTEGRATION/detector-reconciliation phase, NOT a silent
  relaxation of gates to fabricate setups (forbidden by §29).

BLOCKER 2 — FROZEN P3-S.4 PARITY-GUARD COMPATIBILITY (secondary, structural):
  The real-data setup extractor references "FVG" as a Candidate Setup
  zone-type identifier. The frozen P3-S.4 spec suite asserts FVG is ABSENT
  from the ml/ tree (scan_parity_absence: regex on ml/**/*.py == 0 hits).
  Merging the extractor would flip P3-S.4 from 20/20 to 19/20 (FVG-T20).
  The historical suite was NOT modified (correct per §31). The extractor
  scripts are therefore NOT merged into main to preserve the frozen parity
  invariant. This is a documented FUTURE DEPENDENCY: the setup-level FVG
  zone-type namespace and the P3-S.4 parity-absence guard must be reconciled
  by design in a future phase.

CONSEQUENCE: P3-S.17 cannot certify the dataset. Training must NOT start.

C. WHAT WAS VALIDATED (the contract MECHANICS)

- P3-S.16 unit tests re-run: 20/20 PASS (DS-T01..T16 + DS-17..20). Contract
  observation unit, identity, entry=creation-bar-close, TP-before-SL WIN/LOSS/
  UNRESOLVED/AMBIGUOUS, de-overlap, causality, no-leakage, reproducibility all
  hold at the contract/test level.
- The extractor produced a deterministic, reproducible (identical re-run)
  pipeline; NO look-ahead; entry = creation-bar close (M15); TP/SL at ATR(entry);
  de-overlap by lead-setup-per-episode; UNRESOLVED never forced to LOSS.
- These confirm the P3-S.16 label CONTRACT is mechanically sound. What is
  missing is a NON-EMPTY real-data Candidate Setup population, which requires
  reconciling the frozen detectors (BLOCKER 1).

D. REAL-DATA POPULATION & ROOT-CAUSE AUDIT

Scope confirmed from the P3-S.16 handover/contract: XAUUSD M15 2017-01-01 .. 2026-08-20 (194,985 bars; feeds clean per download_report: 0 dups, 0 bad OHLC, 0 anomaly gaps).

total Candidate Setups (raw)     : 0
total observations (all)         : 0
lead setups                      : 0
follow-on setups                 : 0
duplicate setup_ids              : 0
invalid / excluded               : 0

INTERMEDIATE SMC PRIMITIVE COUNTS (root-cause diagnostics):
  sweep_event_onsets         : 84      <-- extremely sparse (proxy liquidity-grab)
  choch_event_bars_nonzero   : 194792  <-- persistent CHoCH state (always present)
  zone_active_bars           : 75861
  zone_unmitigated_bars      : 69      <-- proxy mitigation over-marks (rarely unmitigated)
  m15_entry_bars             : 1418
  h4_bias_bars               : 194985

=> The dominant scarcity drivers are the SWEEP and UNMITIGATED-ZONE proxies.
The frozen F3 chain requires a FRESH sweep + CHoCH-after + ACTIVE UNMITIGATED
OB|FVG + M15 entry, all direction-compatible with H4/M30 gates. Under the
migrated proxies this never co-occurs. This is a detection-fidelity gap (proxy
vs frozen detectors), not a violation of the P3-S.16 label contract.

E. AUDIT SECTION RESULTS (all measured)

Identity     : 0 setups -> no duplicate IDs; causal-key uniqueness n/a (trivially
               consistent). No split/merge faults observable on an empty set.
Entry        : contract entry = creation-bar close (M15). No setups -> no entries.
               Contract rule confirmed deterministic at the test level (DS-T05/T15).
TP/SL        : k_tp/k_sl = 1.5/0.75 default candidate (OPEN param); ATR(entry)
               reference. Not auditable on an empty population; open parameter
               documented, not optimized.
Outcome      : WIN/LOSS/UNRESOLVED/AMBIGUOUS all 0 (empty). Class semantics
               validated at the contract/test level (DS-T07..T11/T16).
Censoring    : n/a (empty). Rule (UNRESOLVED never forced to LOSS) confirmed by
               DS-18.
Ambiguous    : n/a (empty). Same-bar rule confirmed by DS-T10/DS-19.
De-overlap   : rule deterministic (DS-T12/T13); empty here.
Lifetime     : n/a (empty). Contract horizon = 16 (open param); not auto-tuned.
Feature      : feature snapshot is a PROPOSAL (Store 2); no leakage by design
               (DS-T14/T15). Not populated on empty set.
Leakage      : ZERO LOOK-AHEAD at the contract/test level (DS-14/T15/T20). No
               feature references future price.
Quality      : source feed clean (download_report): 0 dup/not-increasing, 0 bad
               OHLC, 0 anomaly gaps in the authorized feeds.
Reproducibility: identical re-run output (deterministic generator). Reproducible.
Temporal     : split/purge rules defined (temporal, purge==horizon, no label-window
               overlap, no future info); not exercised on an empty set.

F. CONTRACT vs REAL DATA (classification per §27)

observation_unit     : PASS (contract)   ; real-data population BLOCKED
identity             : PASS (contract)   ; n/a on empty real set
entry_timestamp      : PASS (contract)   ; deterministic
TP/SL                : PASS (contract)   ; open params, not optimized
horizon              : PASS (contract)   ; open param, no auto-tune
class_semantics      : PASS (contract)
ambiguity            : PASS (contract)
censoring            : PASS (contract)
de-overlap           : PASS (contract)
feature_timing       : PASS (contract; proposal, no leakage)
provenance           : PASS (contract enforces it)
reproducibility      : PASS (deterministic re-run)
REAL-DATA POPULATION : FAIL / BLOCKED (0 observations; detection fidelity)

G. EXPLICITLY UNCHANGED / NOT MODIFIED

Candidate Setup runtime, F1, F2, F4 runtime MTF, FEATURE_CONTRACT.md,
SniperGold_ML.mqh, production .mq5/.mqh, legacy MLP : NONE changed.
NO historical spec suite modified. NO training. NO parameter optimization.
Human verification CANCELLED. No AUC/PF/profit/backtest used.

H. WHY THE EXTRACTION SCRIPTS ARE NOT MERGED

ml/p3/setup_dataset/real_setup_extractor.py and dataset_audit.py are the
session's working diagnostic scripts. They are NOT merged into main because:
  1. they reference "FVG" as a setup zone-type, which flips the frozen P3-S.4
     parity-absence guard (FVG-T20) from PASS to FAIL — a regression we must
     NOT introduce (and must NOT fix by editing the historical suite),
  2. they currently yield an EMPTY real-data population (BLOCKER 1).
Reconciling both is a FUTURE dependency (detector-fidelity + parity-namespace
reconciliation), out of scope for a single audit.
The committed evidence (this report + ml/p3/setup_dataset/output/p3_s17_
dataset_audit.json) records the audit outcome truthfully.

I. NEXT GATE

NOT training. Before any setup-level baseline (P3-S.18), a FUTURE phase must:
  1. Reconcile the real-data SMC extraction with the frozen MQL5 F3/F1/F2
     detectors to obtain a NON-EMPTY, faithful Candidate Setup population.
  2. Reconcile the setup-level FVG zone-type namespace with the frozen P3-S.4
     parity-absence guard (e.g., a designated research-namespace boundary) so
     the guarded regression stays green.
  3. Re-run P3-S.17 audit on the reconciled population.
P3-S.17 ends at this blocked, honestly-documented audit.

End of P3-S.17 dataset audit / label validation. Verdict: DATASET BLOCKED.