## 2 Development of the Algorithm
### Dataset Structure  
To develop the algorithm, we utilized a diverse set of 1928 OCT images of the macular region of patients with AMD. These images covered a wide range of AMD stages and were obtained using OCT on the Avanti XR (Optovue; Fremont, CA, USA) and REVO NX (Optopol; Zawiercie, Poland) devices at the Optimed Laser Vision Restoration Center in Ufa, Russia. Optical coherence tomography imaging of the macular region was performed in all patients using the Radial line mode. The study included OCT images from patients without concomitant pathology of the macular region and with sufficient optical transparency. The analysis was conducted with optimal signal strength and without any artifacts. The original image files obtained from the Avanti X-ray tomograph were screenshots of the main screen of the Optovue application, displaying an OCT B-scan out of fifteen included in Radial Liens, saved in JPEG format. The diagnosticians selected the visualized B-scan measuring 958 by 404 pixels by the criterion of the greatest severity of the characteristic visual signs defining the stage of AMD by their expert experience. Similarly, the REVO NX tomograph produced B-scans of OCT measuring 860 by 580 pixels in JPEG format. The diagnosticians also selected these images based on the presence of radiation lesions, following the same process used for the Avanti X-ray tomograph. The list of classes under consideration included the following cases with the corresponding code designations:  
1. No disease (N) (23%);
2. Early AMD (S) (18%);
3. Intermediate stage (P) (18%);
4. Late AMD;Geographic atrophy (SI) (5%);
* \(\bullet\)  Macular neovascularization (V) (26%) and subretinal fibrosis (VI) (10%). The OCT dataset was divided into three sections: training, validation, and testing, with a distribution of 80%, 10%, and 10%, respectively. We ensured that the validation and testing samples also included examples from all categories considered, with a minimum of 30 examples for each category. The class imbalance caused by the unequal sizes of the SI and VI classes in direct classification required additional solutions, as outlined below. To enhance the accuracy of our proposed classification model for Class P, we implemented a new process for analyzing input OCT images. These images can be categorized as Class P, and the nearest classes, S and V. This analysis aims to evaluate how closely the OCT image, initially classified as Class P, relates to Classes S or V.  
To obtain training data consisting of examples of images belonging to Class P, with varying degrees of proximity to Classes S and V, we conducted additional labeling of images provided by diagnosticians. However, this labeling was not performed for the entire class of P; instead, we focused on a carefully selected group of examples that most effectively represent the proximity of P to stages S and V. This approach was implemented to analyze the minimal amount of time clinicians spend in the design stage of the classification model. One of the key objectives of our approach is to optimize the development process of ML-based medical applications by reducing the involvement of medical personnel. We also decided to enhance the algorithm by enabling it to identify the progression of stage P based on its proximity to stages S and V. By labeling only a portion of the class, users can utilize their expert judgment to personalize the analysis of the intermediate class, reducing potential disagreements among experts. To determine the minimum threshold for the number of examples of class P, we considered several options for the proportion of labeled and unlabeled data: 1/6, 1/4, and 1/3. In the section on algorithm implementation, the choice of the minimum proportion of labeled data was analyzed in terms of its accuracy in identifying the progression of intermediate-class AMD on test samples. The analysis of OCT B-scans obtained from two different tomographs revealed significant differences in the images.