2026-08-22 17:21:46 +07:00 | | | # ml/p3/smc_semantic — SMC Semantic Golden Dataset (Phase 1: LIQUIDITY SWEEP)
|
2026-08-22 07:23:37 +07:00 | | |
|
2026-08-22 17:21:46 +07:00 | | | Session: P3 SMC Semantic Validation (2026-08-22). **NO ML.**
|
2026-08-22 07:46:00 +07:00 | | |
|
| | | ## UPDATE P3-S.0 (2026-08-22) — f7 event lifecycle fix
|
| | |
|
2026-08-22 17:21:46 +07:00 | | | - f7 (DetectLiquidityGrabs) corrected from persistent state -> event lifecycle:
|
| | | `f7_lifecycle()` with expiration `SEQ_WINDOW=40` (InpSeqWindow v4.4 — existing semantics).
|
2026-08-22 07:46:00 +07:00 | | | - Test: `test_f7_lifecycle.py` (R1-R6 + historical) — **15/15 PASS**.
|
2026-08-22 17:21:46 +07:00 | | | - Machine annotation rebuilt: `output/machine_annotations_f7_v2.csv`
|
| | | (22/60 cases changed, all persistent-state corrected; f10/f11 unchanged).
|
| | | - Details: `docs/P3_S_F7_EVENT_LIFECYCLE_FORENSIC.md`.
|
2026-08-22 08:10:48 +07:00 | | |
|
| | | ## UPDATE P3-S.1 (2026-08-22) — Machine Freeze + Human Annotation prep
|
| | |
|
| | | - `machine_annotations_f7_v2.csv` = FROZEN machine reference (source_commit b519a34).
|
| | | - Integrity audit: `integrity_audit.py` -> `output/integrity_audit_f7_v2.json` — ALL PASS
|
2026-08-22 17:21:46 +07:00 | | | (case set 60/60 v1==v2; YES 45 / NO 15 all stale; diff 22/38/22/0 lifecycle-only;
|
| | | field contract complete).
|
| | | - Blind package: `human_package/` (cases.csv, f7 template, protocol, context_m15/) +
|
| | | `machine_package/` (BLINDED — annotators must not open).
|
| | | - `comparison.py` extended: inter-rater A/B + machine-vs-consensus + levels 1-3 +
|
2026-08-22 08:10:48 +07:00 | | | false agreement + timeframe/rejection agreement.
|
2026-08-22 17:21:46 +07:00 | | | - Human annotation: **PENDING** (waiting for annotators A/B -> human_A_f7.csv / human_B_f7.csv).
|
| | | - Details: `docs/P3_S1_HUMAN_MACHINE_F7_VALIDATION.md`.
|
2026-08-22 07:23:37 +07:00 | | |
|
2026-08-22 17:21:46 +07:00 | | | ## Objective
|
2026-08-22 07:23:37 +07:00 | | |
|
2026-08-22 17:21:46 +07:00 | | | Prove whether the MQL5 implementation (FEATURE_CONTRACT v1.0) represents the SMC
|
| | | **Liquidity Sweep** concept semantically the same way humans understand it.
|
2026-08-22 07:23:37 +07:00 | | |
|
2026-08-22 17:21:46 +07:00 | | | ## Architecture
|
2026-08-22 07:23:37 +07:00 | | |
|
| | | ```text
|
2026-08-22 17:21:46 +07:00 | | | MQL5 (existing code) -> machine_annotator.py -> machine_annotations.csv
|
| | | Trader (MT5 chart) -> human_A.csv / human_B.csv (BLINDED, up to decision_timestamp)
|
2026-08-22 07:23:37 +07:00 | | | Python -> comparison.py -> comparison_report.json
|
| | | ```
|
| | |
|
2026-08-22 17:21:46 +07:00 | | | ## Files
|
2026-08-22 07:23:37 +07:00 | | |
|
2026-08-22 17:21:46 +07:00 | | | | File | Role |
|
| | | |------|------|
|
| | | | `smc_semantic_common.py` | shared infrastructure (reuses p3_common + train_model; exact f7/f10/f11 semantics) |
|
| | | | `sample_cases.py` | stratified sampling of 50-100 golden cases (state machine, vol, regime, year) |
|
| | | | `machine_annotator.py` | machine annotation from existing code (v2: f7 lifecycle corrected) |
|
2026-08-22 07:46:00 +07:00 | | | | `test_f7_lifecycle.py` | regression R1-R6 + historical before/after (P3-S.0) |
|
2026-08-22 17:21:46 +07:00 | | | | `human_annotation_template.csv` | empty template for human annotators (A/B) |
|
2026-08-22 07:23:37 +07:00 | | | | `comparison.py` | Human A vs B; Machine vs Human; false-agreement; timeframe audit |
|
2026-08-22 17:21:46 +07:00 | | | | `audit_liquidity_sweep.py` | event-vs-state test + actual definition + spec regression test |
|
| | | | `probe_state.py` | quick state-distribution probe (debug) |
|
| | | | `review_output.py` | sanity check of annotation results |
|
2026-08-22 07:23:37 +07:00 | | | | `output/` | cases.csv, cases_meta.json (BLINDED), machine_annotations.csv, audit JSON, comparison JSON |
|
| | |
|
2026-08-22 17:21:46 +07:00 | | | ## Usage
|
2026-08-22 07:23:37 +07:00 | | |
|
| | | ```text
|
2026-08-22 17:21:46 +07:00 | | | 1. python sample_cases.py 60 42 # create 60 golden cases -> output/cases.csv (+meta BLINDED)
|
2026-08-22 07:23:37 +07:00 | | | 2. python machine_annotator.py # machine annotation -> output/machine_annotations.csv
|
| | | 3. python audit_liquidity_sweep.py # event-vs-state audit -> output/audit_liquidity_sweep.json
|
2026-08-22 17:21:46 +07:00 | | | 4. [HUMAN] copy human_annotation_template.csv -> human_A.csv & human_B.csv;
|
| | | annotators view the MT5 chart ONLY up to decision_timestamp.
|
| | | MUST NOT view cases_meta.json / machine_annotations.csv before finishing.
|
2026-08-22 07:23:37 +07:00 | | | 5. python comparison.py human_A.csv human_B.csv # -> output/comparison_report.json
|
| | | ```
|
| | |
|
2026-08-22 17:21:46 +07:00 | | | ## Key findings of this session (see docs/P3_SMC_SEMANTIC_GOLDEN_DATASET.md)
|
2026-08-22 07:23:37 +07:00 | | |
|
2026-08-22 17:21:46 +07:00 | | | - f7 (DetectLiquidityGrabs) = **PERMANENT STATE**: active 99.95% of bars, NEVER
|
| | | resets to 0 after the first grab; a single grab dominates the state with median 94 bars (max 996).
|
| | | - f10/f11 (DetectEQ) = monotonic state (35-43x repetition per onset).
|
| | | - f10/f11 have **NO close-back/rejection** (definition chosen via AUC, DESAIN_MTF_v45.md).
|
| | | - Machine "no sweep" exists only in 104 bars (0.05%) -> the golden set deliberately
|
| | | uses state age to expose the event-vs-state semantics.
|
| | | - Windowed-vs-fullfeed f7 divergence: 0/1500 probes (empirically a non-issue).
|
2026-08-22 07:23:37 +07:00 | | |
|
2026-08-22 17:21:46 +07:00 | | | ## Discipline
|
2026-08-22 07:23:37 +07:00 | | |
|
2026-08-22 17:21:46 +07:00 | | | Do not choose definitions based on backtests. STOP before production modification
|
| | | if there is definition ambiguity / high human disagreement / event-state bug.
|