Event-Driven Representation Learning in Sparse Financial Time Series

A Macro-Contextual Conceptual Framework and Methodology

Niran Pravithana

VI. Experimental Design, Dataset Construction & Reproducibility Framework

Section นี้ทำหน้าที่กำหนด มาตรฐานเชิงวิธีวิจัยของงานทั้งหมด ว่า

  • ข้อมูลถูกเตรียมอย่างไร
  • การสร้าง label และ event sequence ทำอย่างไร
  • การแบ่งกลุ่มข้อมูลและช่วงเวลาออกแบบอย่างไร
  • การทดลองดำเนินอย่างไรเพื่อให้ผลลัพธ์ ไม่เกิด bias และตรวจสอบซ้ำได้

กล่าวอย่างเป็นทางการ: Section นี้คือ "protocol ของงานวิจัย" ที่รับรองว่า ผลที่ได้มาจากโครงสร้างกระบวนการที่โปร่งใสและ reproducible ไม่ใช่ผลของการ tuning แบบ trial-and-error

6.1 Dataset Definition — Multi-Asset Event-Time Panel

ให้มีชุดสินทรัพย์

$$\mathcal{A} = \{a_1,\dots,a_M\}$$

และช่วงข้อมูล

$$[T_{start}, T_{end}]$$

สำหรับสินทรัพย์ $a$ ชุดเหตุการณ์แบบรวม (จาก Section 2):

$$\tilde{\mathcal{S}}^a = \{(t_i^a, x_i^a, v_i^a)\}_{i=1}^{N_a}$$

พร้อมราคาเวลาไม่ต่อเนื่อง

$$P^a(t), \quad t\in\mathcal{T}^a$$

ชุดข้อมูลรวมทั้งระบบ

$$\mathcal{D} = \big\{ (\tilde{\mathcal{S}}^a, P^a(t)) \mid a\in\mathcal{A} \big\}$$

กล่าวเชิงโครงสร้าง:

  • เป็น panel data แบบ event-time
  • ไม่ได้อิง sampling เป็นระยะเท่ากัน
  • เน้นโครงสร้าง "เหตุการณ์ → ลำดับ → outcome"

6.2 Event Construction Protocol (Asset & Macro Levels)

6.2.1 Asset-Level Event Extraction

เหตุการณ์มาจากฟีเจอร์ต่างชนิด เช่น

  • Boolean condition triggers
  • factor-state transitions
  • indicator crossing events
  • structural / fundamental signals

นิยามตัวสร้างเหตุการณ์

$$\Phi_{asset}: \text{raw feature stream} \longrightarrow \mathcal{X}_{asset}$$

ข้อกำหนด:

  1. เหตุการณ์ต้องเกิดจากข้อมูล ที่ทราบ ณ เวลานั้นจริง
  2. ห้ามใช้ข้อมูลที่มีการ back-fill
  3. ต้องเก็บ timestamp ก่อน outcome อย่างเคร่งครัด

6.2.2 Macro-Level Event Definition

ชุด macro event:

$$\mathcal{M} = \{(t_j^{macro}, m_j)\}$$

ต้องถูกนิยามตามเกณฑ์ ex-ante observable rule เช่น

  • วันที่เริ่ม QE ตามประกาศจริง
  • วันที่อัตราดอกเบี้ยเปลี่ยน
  • วันที่ shock ถูกบันทึกใน public source

ไม่อนุญาตให้กำหนดแบบ hindsight เช่น "มองย้อนหลังแล้วถือว่าช่วงนี้คือ crisis"

จึงต้องระบุชุดแหล่งข้อมูลประกาศจริง และ freeze definitions ก่อนเริ่ม training

6.2.3 Unified Event Merge Procedure

กระบวนการรวม sequence (สำหรับสินทรัพย์ $a$):

$$\tilde{\mathcal{S}}^a = \text{merge-sort}(\mathcal{S}^a, \mathcal{M})$$

และบังคับ invariants:

  1. เวลาไม่ถอยหลัง $t_1^a \le t_2^a \le \dots$
  2. macro events เหมือนกันทุกสินทรัพย์
  3. ไม่มีการสร้าง event ย้อนหลัง

6.3 Outcome Label Construction

ให้ผลตอบแทนช่วงอนาคต

$$r^a(t,\Delta) = \frac{P^a(t+\Delta)-P^a(t)}{P^a(t)}$$

นิยามฟังก์ชัน outcome

$$y_t^a = g(r^a(t,\Delta))$$

ตัวอย่าง threshold-based:

$$y_t^a = \begin{cases} 1, & r^a(t,\Delta) \ge \tau_{up}\\ -1, & r^a(t,\Delta) \le \tau_{down}\\ 0, & \text{otherwise} \end{cases}$$

ข้อกำหนด สำคัญ:

  • $y_t^a$ ต้องใช้เฉพาะราคาในช่วง $[t, t+\Delta]$
  • ห้ามใช้ median / forward fill ข้ามอนาคต
  • กำหนด $\tau$ และ $\Delta$ ก่อนเริ่มทดลอง และ ล็อกค่า

6.4 Causal-Safe Training Window Construction

สำหรับแต่ละ sample เวลา $t$

$$X_t^a = \tilde{\mathcal{S}}^a_{(-\infty,t)}$$
$$Y_t^a = y_t^a$$

กล่าวคือ

$$(X_t^a, Y_t^a) \quad\text{ถูกสร้างแบบ} \quad \textbf{past} \rightarrow \textbf{future}$$

ห้ามสร้าง window แบบ rolling retrospective ที่กินอนาคต

6.5 Temporal Splitting & Forward Evaluation Protocol

เพื่อคง time-causal validity แบ่งเป็น

  • train
  • validation
  • test

โดย

$$T_{train} < T_{val} < T_{test}$$

และทดลองแบบ rolling-forward:

$$\Pi_k = \Pi\left( [t_k, t_{k+1}] \right)$$

ช่วยให้:

  • ตรวจสอบ performance stability ตามเวลา
  • ลดความเสี่ยงเลือกช่วงที่ bias

6.6 Experimental Arms (What We Compare Against)

เพื่อให้ผลวิจัยมีความหมาย ต้องมี baseline ที่เปรียบเทียบได้

6.6.1 Baseline Models

  1. Random / Majority baseline
  2. Logistic regression บน aggregated features
  3. GRU / LSTM (no macro tokens)
  4. Transformer without macro tokens
  5. Transformer with macro tokens (proposed)

เป้าหมาย: ไม่ใช่เพื่อชนะ baseline แต่เพื่อพิสูจน์ว่าการใส่ "ลำดับเหตุการณ์ + macro context" มีมูลค่าทางข้อมูลเชิงโครงสร้าง

6.7 Hyperparameter Governance (Pre-Analysis Rule)

เพื่อหลีกเลี่ยง tuning-bias ตั้งค่าเป็น pre-registered ranges

ตัวอย่าง:

$$d \in \{64, 128, 256\}$$
$$L \in \{2, 4, 6\}$$
$$\lambda_g \in \{10^{-4}, 10^{-3}, 10^{-2}\}$$

การเลือก final model:

  • ใช้ validation ที่แบ่งตามเวลา
  • ไม่อนุญาต retro-selection จาก test set

6.8 Reproducibility Requirements

งานวิจัยจะถือว่า reproducible เมื่อมี:

  1. Versioned dataset recipe (ไม่จำเป็นต้องเปิดข้อมูลดิบ แต่ต้องเปิดสูตรสร้าง)
  2. Config-locked experiment files เช่น YAML / JSON
  3. บันทึก commit hash, random seed, hyperparameters, training log
  4. ฟังก์ชันตรวจสอบความสอดคล้อง เช่น
$$\text{Hash}(\tilde{\mathcal{S}}^a) = \text{constant}$$

เพื่อยืนยันว่า sequence ไม่เปลี่ยนระหว่างรัน

6.9 Error & Risk Audit — What Can Go Wrong

เพื่อความโปร่งใส ต้องประเมินความเสี่ยงที่อาจเกิด เช่น

  • regime mis-labeling
  • survivorship bias ของ universe หุ้น
  • corporate action causing price jumps
  • missing-event distortion
  • redundancy of correlated events

ทุกข้อควรถูกบันทึกใน risk appendix

6.10 Interpretation Scope & Ethical Boundary

เอกสารกำหนดว่า

  • ผลลัพธ์ใช้เพื่อ การวิจัยเชิงโครงสร้าง
  • ไม่ตีความเป็นเครื่องมือคาดการณ์กำไร
  • ไม่อ้าง causal claim โดยตรง
  • เป็นการศึกษาเชิง pattern-relation เท่านั้น

6.11 Connection to Final Sections

เมื่อ Section 6 วางรากฐานด้าน dataset, experiment protocol, reproducibility

Section ถัดไปจะมุ่งสู่ Limitations, Extensions & Future Research Directions (ขอบเขตจำกัดของงาน, กรอบขยาย, และทิศทางวิจัยต่อยอด)