## 2 Materials and Methods
### Clinical Data Curation  
Let the raw OCT dataset \(D_{raw}=\{(I_{i},y_{i})\}_{i=1}^{N}\) contain \(N\) retinal scans \(I_{i}\in\mathbb{R}^{H_{x}\times W\times C}\) with diagnostic labels \(y_{i}\in\{\text{AMD, DME, CNV, Healthy}\}\). To preserve pathological biomarker distributions across splits while maintaining clinical relevance, we implement proportional stratified partitioning:  
\[\forall c\in\mathcal{C},\frac{|D_{split}^{c}|}{|D_{split}|}=\frac{|D_{raw}^{ c}|}{|D_{raw}|}\pm\epsilon,\epsilon<0.01 \tag{1}\]  
where \(\mathcal{C}=\{\text{AMD, DME, CNV, Healthy}\}\) denotes pathological classes and \(\epsilon\) the maximum distributional divergence. Here, the parameter \(\epsilon\) (<0.01) is selected based on empirical observations to ensure that the relative class distribution in each data split closely mirrors that of the raw dataset. The Algorithm 1 ensures equivalent representation of retinal layer abnormalities across partitions. ```
Input: Source directory \(D_{\text{src}}\), output root \(D_{\text{out}}\), splits \((0.7,0.15,0.15)\) foreach pathology \(c\in\mathcal{C}\)do \(\mathcal{I}_{c}\leftarrow\textsc{LoadOCT}(D_{\text{src}}/c,\{\_\text{png,.jpg}\})\); \(\mathcal{I}_{c}^{\text{shuffled}}\leftarrow\textsc{FisherYatesShuffle}( \mathcal{I}_{c})\); \(n_{\text{train}}\leftarrow\lfloor|\mathcal{I}_{c}|\times 0.7\rfloor\); \(n_{\text{val}}\leftarrow\lfloor|\mathcal{I}_{c}|\times 0.15\rfloor\); \(\mathcal{P}\leftarrow[\text{train}]^{n_{\text{train}}}\oplus[\text{val}]^{n_{ \text{val}}}\oplus[\text{test}]^{|\mathcal{I}_{c}|-n_{\text{train}}-n_{\text{val}}}\); foreach\(I_{j}\in\mathcal{I}_{c}^{\text{shuffled}}\)do \(D_{\text{dest}}\gets D_{\text{out}}/\mathcal{P}[j]/c\);  CopyMedicalImage\((I_{j},D_{\text{dest}})\);  end foreach
```  
**Algorithm 1**Stratified OCT data partitioning. The implementation utilized a random seed for reproducibility and operated on a nested directory structure where each primary class folder contained OCT images categorized by pathological status. Non-random stratification was critical to ensure balanced representation of subtle pathological features across training, validation, and testing partitions. Our dataset partitioning algorithm employs a controlled randomization approach to guarantee proportional representation while preventing data leakage between partitions that could artificially inflate performance metrics. The raw dataset distributions were maintained through the following constraint:  
\[\forall c\in\mathcal{C},\left|\frac{|D_{train}^{c}|}{|D_{train}|}-\frac{|D_{ \text{out}}^{c}|}{|D_{\text{out}}|}\right|<0.03, \tag{2}\]  
The threshold of 0.03 was determined to maintain a consistent balance between training and validation sets, as supported by preliminary analyses. Each image in the partitioned dataset was processed through integrity verification to ensure metadata preservation and anatomical landmark retention. This verification process involved checking spatial resolution, bit depth, and pathological marker presence in boundary regions:  
\[\mathcal{V}(I)= \begin{cases}1,&\text{if }\frac{1}{|R|}\sum_{c\in R}\sigma(I_{r})> \tau_{var}\text{ and }b(I)=16\text{ bit}\\ 0,&\text{otherwise}\end{cases}  \tag{3}\]  
where \(R\) represents regions of interest containing expected pathological markers, \(\sigma(I_{r})\) is the standard deviation in region \(r\), and \(\tau_{var}\) is the variance threshold for clinically significant feature detection. The stratified data partitioning approach was selected over alternative methods (such as simple random sampling or time-series splitting) to preserve pathological feature distributions across all data subsets, which is critical for retinal OCT classification where biomarker representation must be consistent between training and deployment environments.