Next Article in Journal
Machine Learning in Education
Next Article in Special Issue
Localization in Medical Imaging: A Unified AI Approach for Ovaries, Follicles, and Vertebral Arteries
Previous Article in Journal
Unmanned Ground Vehicle Path Planning Algorithms: A Review
Previous Article in Special Issue
A Data-Centric Algorithmic Pipeline for Enhancing Cardiac MRI Segmentation Using ViTUNeT and Quality-Aware Filtering
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Surrogate-Based Optimization of Interpretable Regular Expression Patterns for the Classification of Retinal Lesions in Retinal Fundus Images

by
Rafael A. García-Ramírez
1,
Ivan Cruz-Aceves
2,*,
Arturo Hernández-Aguirre
1,
Juan-Manuel Lopez-Hernandez
3,
Gloria P. Trujillo-Sánchez
4 and
Martha A. Hernandez-González
5
1
Centro de Investigación en Matemáticas (CIMAT), Guanajuato 36023, Guanajuato, Mexico
2
SECIHTI-Centro de Investigación en Matemáticas, Guanajuato 36023, Guanajuato, Mexico
3
División de Ingenierías (DICIS), Campus Irapuato-Salamanca, Universidad de Guanajuato, Carretera Salamanca-Valle de Santiago km 3.5 + 1.8 km, Comunidad de Palo Blanco, Salamanca 36885, Guanajuato, Mexico
4
Unidad Medica de Alta Especialidad, Hospital de Especialidades No. 1 IMSS, León 37320, Guanajuato, Mexico
5
División de Ciencias de la Salud, Universidad de Guanajuato, Campus León, León 37544, Guanajuato, Mexico
*
Author to whom correspondence should be addressed.
Algorithms 2026, 19(6), 440; https://doi.org/10.3390/a19060440
Submission received: 15 April 2026 / Revised: 20 May 2026 / Accepted: 25 May 2026 / Published: 1 June 2026
(This article belongs to the Special Issue AI-Powered Biomedical Image Analysis)

Abstract

The correct classification of retinal lesions in retinal fundus images is important for supporting the analysis of diabetic retinopathy and age-related macular degeneration. State-of-the-art methods for this task are often based on black-box deep learning architectures that, despite their high performance, pose significant interpretability challenges, incur high computational costs, and lack computational interpretability at the feature-decision level. In this paper, a method based on surrogate-optimized features extracted by regular expressions is proposed for the classification of two retinal lesion categories (Drusen and Cotton Wool Spots). The method uses a compact and computationally interpretable row-by-row and column-by-column regular expression feature extractor together with a two-phase surrogate search over its discrete hyperparameters. Across 100 independent stratified executions under the repeated patch-level benchmark, the proposed method achieved a mean MCC of 0.7829 ± 0.0448 , a mean accuracy of 0.9008 ± 0.0217 , and a mean F1 score of 0.8529 ± 0.0294 . The best execution reached an MCC of 0.8433 , an accuracy of 0.9286 , and a macro F1 score of 0.8966 , which was the highest result among the evaluated baselines within that same benchmark. Additional source–image disjoint grouped analyses were carried out as leakage-aware robustness checks under stricter source–image separation and to examine validation overfitting. Together, these analyses support the usefulness of the compact run-based descriptor under the present experimental conditions, while indicating that the two-phase search should be interpreted as a practical hyperparameter selection heuristic rather than as a statistically superior search strategy.

1. Introduction

In retinal fundus analysis, disease entities and localized lesion findings should be distinguished carefully. Diabetic retinopathy and age-related macular degeneration are disease contexts, whereas Cotton Wool Spots and Drusen are retinal lesions or imaging findings that may appear within those contexts. The task studied in this paper is not the direct diagnosis of macular edema or age-related macular degeneration from a full fundus image; rather, it is a binary patch-level discrimination between two annotated retinal lesion categories [1,2].
Cotton Wool Spots are superficial retinal lesions associated with focal nerve fiber layer ischemia and are commonly reported in diabetic retinopathy and other vascular disorders. In contrast, macular edema is defined more specifically by retinal thickening or fluid accumulation, often assessed with multimodal imaging. For this reason, Cotton Wool Spots should not be treated as synonyms of macular edema, even though both may appear in related clinical settings [3,4,5,6,7,8,9,10,11,12,13,14,15,16].
Drusen, in turn, are extracellular deposits located between the retinal pigment epithelium and Bruch membrane and are imaging findings classically associated with age-related macular degeneration. Their detection remains challenging because the deposits may be small, their local appearance can overlap with surrounding retinal structures, and their clinical interpretation depends on size, distribution, and broader fundus context [17,18].
Accordingly, this work focuses on two lesion categories frequently identified in the annotated material provided by the High-Specialty Medical Unit (UMAE) of the Mexican Social Security Institute (IMSS): Cotton Wool Spots and Drusen. Figure 1 provides the anatomical reference used to situate these lesion patches within the retinal field, although the classifier itself operates only on the local 32 × 32 patch content.
Full clinical interpretation still requires patient history, multimodal imaging, and spatial context beyond the local patch. The present method does not attempt to replace that full diagnostic reasoning. Instead, it aims for computational interpretability: the prediction can be traced to an explicit thresholding rule, run-length constraints, and a linear decision function defined on a compact descriptor.
Among methods that use annotated data, recent studies have focused mainly on CNN-based architectures for segmenting microaneurysms, exudates, hemorrhages, and other retinal structures in RFI [19,20,21,22]. In these systems, preprocessing is important because it can improve color normalization and reduce noise. Some approaches use multistage CNN pipelines that classify pixels as lesion or non-lesion, with good performance for certain lesion types but nontrivial computational cost. Other CNN-based methods address limited annotation through transfer learning [23], Glowworm Swarm Optimization for parameter tuning [24], or combinations of filtering with conventional segmentation methods such as the Hough transform and Gabor filters [25,26]. Another line of work uses stochastic networks as unsupervised backbones, including Deep Belief Networks [27] and Convolutional Deep Belief Networks [28].
The approach proposed in this paper, however, is based on regular expressions applied as structural descriptors over binarized image patches, combined with surrogate optimization for hyperparameter selection and ridge classification. Regular expressions have been used in text processing and information extraction for the identification and retrieval of relevant data from structured and unstructured sources. In the domain of image data, for instance, genetic algorithms have been applied to the automatic generation of regular expressions for extracting relevant image content from web pages [29]. In other intelligent monitoring domains, compact computationally interpretable pipelines based on explicit signal processing components have also been used when robustness and efficient deployment are important [30]. In this work, the structural patterns captured by regular expressions are exploited at the pixel level to distinguish between lesion classes in low-resolution retinal patches. The goal of this article is to present a method that converts retinal patches into binary fields and then extracts run-length statistics through regular expression-based constraints, producing a computationally interpretable and compact 32-dimensional descriptor whose hyperparameters are selected by a two-phase surrogate search. The main contributions are: (i) a run-based feature extraction scheme driven by regular expression constraints that produces a fixed, computationally interpretable descriptor from binarized retinal patches; (ii) a two-phase surrogate optimization strategy designed to explore stable regions of the discrete search space, together with robustness analyses that compare it against one-phase TPE and random search under grouped validation; and (iii) a leakage-aware source–image disjoint evaluation showing that the proposed descriptor remains informative on a specialist-annotated low-resolution dataset under stricter grouped protocols.
The remainder of this paper is organized as follows. Section 2 describes the database properties and the methodological background. Section 3 presents the proposed method. Section 4 reports the experimental results and discussion. Section 5 presents the conclusions and discusses directions for future work.

2. Database and Methodological Background

This section describes the database, the acquisition and annotation procedures, and the main methodological elements of the proposed pipeline. The composition of the dataset, the criteria followed for expert annotation, and the visual characteristics that make the classification problem difficult at the patch level are presented first. The methodological components are then introduced in the order in which they appear in the pipeline.

2.1. Retinal Lesion Patch Database

All labels were produced by Dr. Gloria P. Trujillo Sánchez, an ophthalmology specialist in the Department of Ophthalmology at the Mexican Institute of Social Security, IMSS T1 León. The database contains RGB retinal fundus images of size 400 × 600 from 18 patients with Drusen and 31 patients with Cotton Wool Spots. Specialist annotations of size 32 × 32 pixels yield 211 image patches: 70 Cotton Wool Spots and 141 Drusen. Therefore, the resulting dataset defines a two-class patch-level retinal lesion classification problem with a moderate class imbalance in favor of Drusen.
In the context of the complete database, Cotton Wool Spots and Drusen correspond to the two lesion classes with the lowest representation. This reduced number of annotated samples is relevant from a methodological point of view, since it limits the amount of training information available for both categories and increases the difficulty of learning stable decision boundaries at the patch level. Consequently, the classification task must be addressed under conditions of limited sample support, particularly in the case of Cotton Wool Spots.
Figure 2 shows a sample set from each class in the database. It highlights why patch-level classification is difficult in this dataset. The classes often share color and intensity, and the morphological differences are subtle. Individual patches may also contain vessels and other anatomical structures. For this reason, the classification must rely on fine structural differences rather than on gross tonal contrast. In addition, the reduced spatial support of the patches limits the amount of contextual information available to the classifier, which increases the difficulty of the discrimination task. As may be observed, the overlap between classes is not restricted to chromatic information alone, but also involves similarities in local appearance, texture, and brightness patterns. These characteristics indicate that successful classification depends on the ability to capture subtle structural evidence at a local scale.
Figure 3 shows the spatial distribution of the annotated lesion patches across the retinal fundus images. Each map accumulates patch positions from the full database, so warmer regions indicate higher annotation frequency. Cotton Wool Spots appear more often in peripheral regions, whereas Drusen are concentrated closer to the central area. The physiological basis of this spatial pattern is not examined here. The maps are included to show how the annotated lesions are distributed over the retinal field and to confirm that the two lesion categories occupy different regions, a property of the database that is worth noting even though spatial location is not used as a feature in the present work.
Most publicly available retinal datasets focus on severity grading of diabetic retinopathy or age-related macular degeneration over full fundus images, or on pixel-wise detection and segmentation of individual lesion types. To the best of the authors’ knowledge, none of them defines a two-class patch-level classification task that isolates Cotton Wool Spots and Drusen as the target categories at this resolution. Because no external benchmark with this exact class definition and data regime is available, a direct comparison against previously published results on other datasets is not feasible. The comparative analysis in Section 4.2 addresses this by training and evaluating all baselines on the present dataset under the same protocol, with evaluation conditions adapted to each model family: deep architectures received data augmentation and standard training schedules, tree-based and linear classifiers operated on the features defined by each method, and handcrafted descriptors were paired with the same ridge classifier used by the proposed pipeline. This design ensures that the comparison reflects the specific combination of pathologies, resolution, and sample size that define the problem.

2.2. Methods

Low-resolution retinal patches are difficult to classify because the lesion classes often share color and intensity and are affected by noise, acquisition artifacts, and nearby anatomical structures. Under these conditions, structural descriptors may be more useful than descriptors based only on local photometric statistics. A similar difficulty was reported in recent retinal patch-classification work, where ambiguity between classes was attributed to the similarity of low-level features [28]. For this reason, the proposed method uses regular expressions as structural descriptors applied to binarized image patches. The regular expressions define minimum-length constraints on contiguous runs of ones and zeros, and the resulting run-length statistics capture continuity, fragmentation, and spatial extent at the row and column level.
The method begins with a controlled binarization step so that the subsequent analysis focuses on support, continuity, and fragmentation rather than on absolute intensity values. The main components are percentile thresholding, run-constrained binary patterns extracted through regular expression constraints, surrogate optimization for hyperparameter selection, and ridge regularization. A graphical overview of the pipeline is provided in Figure 4, and the full algorithm is given in Section 3.

2.2.1. Percentile Thresholding as a Controlled Binarization Rule

Let A { 0 , , 255 } H × W × 3 denote an RGB patch. From A, a single intensity field X R H × W is derived through a luminance mapping. Given X, the binarization rule defines a threshold τ and the corresponding binary mask B { 0 , 1 } H × W . At the formal level, percentile thresholding defines τ through order statistics within the patch. Let vec ( X ) R H W denote vectorization, and let Q p denote the pth percentile operator. For p ( 0 , 100 ) ,
τ ( X ; p ) = Q p vec ( X ) .
From there, the binary mask may be defined in either of two ways:
B i , j = I X i , j τ ( X ; p ) ,
Alternatively, an inverted rule may be used:
B i , j = I X i , j < τ ( X ; p ) .
Percentile thresholding is appropriate for low-resolution patches for several reasons. The percentile p fixes the fraction of activated pixels and therefore gives direct control of the binary support. Because the rule depends on rank rather than absolute intensity, it is invariant to strictly monotonic intensity transformations and less sensitive to global illumination changes. Extreme pixels influence the cutoff only when p is close to the ends of the range. In small patches with sparse, multimodal, or background-dominated histograms, the rule may still remain stable even when bimodality is absent.
This differs from Otsu thresholding, which selects τ by maximizing between-class separation and works best when the histogram is close to bimodal. In retinal patches, lesion pixels share the field with background tissue and anatomical structures, so the histogram may be multimodal or dominated by a single mode. For this reason, percentile thresholding provides a more controlled support for the run-based analysis.

2.2.2. Run-Constrained Binary Patterns and Regular Expressions

A run-constrained binary pattern is a representation that summarizes the spatial organization of a binary image by measuring the lengths, counts, and continuity of contiguous blocks (runs) of identical pixel values, subject to minimum-length constraints. Once a binary field B { 0 , 1 } H × W has been obtained, each row and each column can be read as a binary string. For a row index r, define s r row = ( B r , 1 , , B r , W ) { 0 , 1 } W . For a column index c, define s c col = ( B 1 , c , , B H , c ) { 0 , 1 } H . A run is a maximal contiguous block of identical symbols within a sequence. If s = ( s 1 , , s L ) , then indices a b form a run when s a = = s b , while s a 1 s a when a > 1 , and s b + 1 s b when b < L . The run length is = b a + 1 .
Regular expressions provide a compact way to state these run constraints. For example, a sequence of ones of length at least m may be written as 1 { m , } , and 0 { m , } denotes a background run of zeros of length at least m. In the implementation, however, the method does not call a full regular expression engine. Each binary sequence is scanned once and the same quantities are obtained directly. This is computationally cheaper during hyperparameter search.
The resulting run statistics describe continuity, fragmentation, and total extent. Since a single pixel can split a run and change the maxima and totals, the threshold and run parameters must be chosen carefully. Minimum-length constraints reduce the influence of short fragments, but they do not remove this sensitivity.

2.2.3. Surrogate Optimization for Hyperparameter Selection

The proposed method requires selecting the hyperparameters that control binarization and run extraction: the percentile threshold p, the polarity flag, the minimum run lengths m 1 and m 0 , and the long-run threshold L. These parameters define the structural descriptor from which the classifier operates, and their selection can be formulated as a black-box optimization problem. The real objective function is the classification performance measured on validation data, for example through the Matthews correlation coefficient or a stability-aware fitness score that penalizes the gap between training and validation performance. This function is expensive to evaluate in aggregate because each candidate configuration requires binarizing all training images, extracting run-length features, fitting a ridge model, and computing the resulting metric. In addition, the objective function may be discontinuous with respect to the discrete parameters and may also be affected by noise introduced by data resampling. A surrogate optimization approach is therefore applied: instead of evaluating all possible configurations, a probabilistic model is built from the evaluations collected so far and used to guide the selection of the next candidate.
Formally, let θ Θ denote a candidate configuration and let f : Θ R denote the objective function.
Several standard strategies may be used to explore this type of search space. Grid search evaluates the Cartesian product of predefined candidate values, but its computational cost increases combinatorially with the number of parameters and with the number of values considered for each parameter. Random search samples configurations independently and often improves upon grid search when only a subset of dimensions is truly influential. However, it remains non-adaptive and therefore continues allocating evaluations to regions that have already shown little promise. In contrast, surrogate optimization follows a sequential model based strategy in which past observations are used to guide future evaluations. After t evaluations, the observation set is given by
D t = { ( θ i , y i ) } i = 1 t , y i = f ( θ i ) + ε i ,
where ε i represents measurement noise. On the basis of these observations, a surrogate model induces a predictive distribution for f ( θ ) at any candidate θ . In many practical constructions, this predictive distribution is summarized through a mean μ t ( θ ) and a standard deviation σ t ( θ ) . The next candidate is selected by maximizing an acquisition function a t , so that
θ t + 1 arg max θ Θ a t ( θ ) .
The acquisition function balances exploration and exploitation. The predictive uncertainty σ t ( θ ) controls exploration, since regions with large σ t have not been sufficiently sampled and may contain good solutions. The predictive mean μ t ( θ ) controls exploitation, since regions with favorable μ t are likely to contain good objective values based on the observations collected so far.
Common acquisition rules are written directly in terms of μ t and σ t . In minimization settings, let f t = min i t y i denote the best observed value. The expected improvement criterion is then defined as
EI t ( θ ) = E max 0 , f t f ( θ ) D t .
In practice, the predictive distribution at each candidate θ is assumed to be Gaussian with mean μ t ( θ ) and standard deviation σ t ( θ ) . This assumption is adopted for computational convenience, since the true distribution of f ( θ ) is generally unknown and unlikely to be exactly Gaussian. Under this assumption, expected improvement has a closed form and is larger when μ t ( θ ) is small and σ t ( θ ) is large. Confidence-bound strategies follow a related principle. The Lower Confidence Bound (LCB) acquisition function is defined as
LCB t ( θ ) = μ t ( θ ) κ σ t ( θ ) ,
and candidates are selected by minimizing LCB t . The scalar κ > 0 controls how much weight is given to exploration relative to exploitation: larger values of κ encourage the selection of candidates in regions with high uncertainty. The expected improvement and LCB formulations above are presented for completeness, since they are the most common acquisition functions in the surrogate optimization literature. In the present work, the surrogate method actually used is the Tree-structured Parzen Estimator (TPE), which is suited for mixed and discrete search spaces. The TPE models p ( θ y ) by splitting the observations collected so far into a good set and a bad set through a quantile threshold y . This produces two densities,
( θ ) = p ( θ y y ) , g ( θ ) = p ( θ y > y ) .
Candidate generation then favors configurations that are more likely under than under g, often through maximization of a ratio of the form ( θ ) / g ( θ ) . In this way, the search is directed toward regions that have produced good objective values, while retaining enough diversity to reduce premature convergence in irregular objective spaces. Once the TPE selects the best configuration from the surrogate search, the corresponding ridge model is fitted on the training data with the selected hyperparameters, and the resulting weight vector w ^ α together with the intercept b ^ define the linear decision function used for classification.

2.2.4. Ridge Classification Recast in Explicit Mathematical Form

After feature extraction, each sample is represented by a vector x R d , and the linear score is s ( x ) = w x + b , with prediction y ^ = sign ( s ( x ) ) in the binary setting. Let X R n × d denote the design matrix whose rows are feature vectors, and let y R n denote a numerical encoding of the labels, for example through 1 and + 1 . The ridge classifier can then be written as a regularized least-squares problem
min w R d , b R y X w b 1 2 2 + α w 2 2 , α > 0 ,
where 1 denotes the vector of ones. If the columns of X and the vector y are centered so that the intercept can be omitted, the ridge solution has the closed form
w ^ α = X X + α I 1 X y .
When the intercept is retained without centering, a standard identity gives b ^ = y ¯ w ^ α x ¯ , where x ¯ denotes the mean feature vector and y ¯ denotes the mean label encoding. The effect of ridge regularization may be seen more clearly through spectral analysis. Let X X = V Σ V be an eigendecomposition with orthonormal V and diagonal Σ containing the nonnegative eigenvalues σ 1 , , σ d . It then follows that
X X + α I = V ( Σ + α I ) V ,
so the eigenvalues are shifted from σ i to σ i + α . Two consequences follow. First, invertibility is guaranteed for any α > 0 , even when X X is singular. Second, numerical conditioning improves because small eigenvalues, which correspond to nearly dependent feature directions, are displaced away from zero by α . As a result, the estimator tends to have lower variance along directions affected by multicollinearity.
This is relevant for the descriptor family used here. Run-derived features may be strongly correlated because several statistics summarize the same structure from different viewpoints. A simple example arises when one feature is a normalized version of another: if u denotes the sum of accepted run lengths and v the corresponding coverage, then v = u / ( H W ) , which implies exact linear dependence. Approximate dependence also appears when row-wise and column-wise summaries reflect the same geometric structure. In this setting, ridge shrinkage stabilizes the estimator by reducing large coefficients induced by correlated predictors while preserving a direct relation between features and decisions.
For the proposed ridge model, the quantity used in threshold-free ranking analyses is the signed decision score s ( x ) returned by the linear decision function. AUROC and one-versus-rest precision–recall curves are therefore computed directly from these scores. No additional score transformation was applied for these analyses.

3. Proposed Method

The proposed pipeline consists of deterministic transformations followed by surrogate optimization over a discrete hyperparameter space. The method is described in eight steps.
  • Step 1. Intensity field construction. Given an RGB patch A { 0 , , 255 } 32 × 32 × 3 , an intensity field X R 32 × 32 is computed using luminance
    X i , j = 0.299 A i , j , 1 + 0.587 A i , j , 2 + 0.114 A i , j , 3 .
  • Step 2. Percentile threshold selection. Given a percentile hyperparameter p ( 0 , 100 ) , a patch-specific threshold is computed
    τ = Q p vec ( X ) ,
    where Q p is the percentile operator.
  • Step 3. Binary mask construction. A binary mask B { 0 , 1 } 32 × 32 is then obtained using a polarity hyperparameter invert . If invert = 0 then
    B i , j = I [ X i , j τ ] .
    If invert = 1 then
    B i , j = I [ X i , j < τ ] .
  • Step 4. Run extraction with minimum length constraints. Each row and each column of B is scanned to extract maximal runs of identical symbols. Two integer hyperparameters are used: m 1 for one-runs and m 0 for zero-runs. A one-run is retained only if its length satisfies m 1 , and a zero-run only if m 0 . For each of the four cases, rows ones, columns ones, rows zeros, and columns zeros, three summaries are computed. The maxima array M stores the maximum valid run length per line, the count array C stores the number of valid runs per line, and the sum S stores the total length of all valid runs across lines.
  • Step 5. Long-run structure and block continuity. A long-run threshold hyperparameter L defines a long-run flag per line
    Λ ( ) = I [ M ( ) L ] ,
    where indexes a row or a column. Two long-run descriptors are then computed for each case. The long-run count is Λ ( ) . The long-run block length is the maximum number of consecutive lines with Λ ( ) = 1 .
  • Step 6. Explicit construction of the 32 dimensional descriptor. A fixed descriptor f ( A ) R 32 is assembled from four coverage features and twenty-eight run summary features. The four coverage features are defined by
    cov 1 row = S 1 row 32 2 , cov 0 row = S 0 row 32 2 , cov 1 col = S 1 col 32 2 , cov 0 col = S 0 col 32 2 .
    For each case determined by an orientation o { row , col } and a polarity b { 1 , 0 } , define the per-line maxima array M b o , the per-line count array C b o , and the long-run flag array Λ b o derived from M b o and L. Seven summary features are computed per case:
    max ( M b o ) , mean ( M b o ) , std ( M b o ) , C b o , mean ( C b o ) , Λ b o , blockmax ( Λ b o ) ,
    where blockmax returns the maximum length of a consecutive block of ones in a binary sequence. The final descriptor is formed by concatenation in a fixed order. First the four coverages are appended, then seven features for rows ones are appended, seven features for columns ones are appended, seven features for rows zeros are appended and lastly seven features for columns zeros are appended.
  • Step 7. Standardization and ridge decision function. Given descriptors x i = f ( A i ) , each dimension is standardized using the training-set mean μ k and standard deviation σ k :
    x ˜ i , k = x i , k μ k σ k .
    A ridge model is fitted and produces a score
    s ( x ) = w x ˜ + b , y ^ = sign s ( x ) .
  • Step 8. Two-phase surrogate optimization for hyperparameter selection. The hyperparameters are collected as θ = ( p , invert , m 1 , m 0 , L ) , where θ Θ and Θ is a discrete search space. Selection proceeds in two phases. The first phase seeks configurations whose training performance does not substantially exceed validation performance. For a candidate configuration θ , the ridge model is trained on the training split and evaluated on both training and validation splits. Let MCC tr ( θ ) and MCC val ( θ ) denote the corresponding Matthews correlation coefficients. The phase one objective is the generalization gap
    g ( θ ) = MCC tr ( θ ) MCC val ( θ ) .
    Surrogate optimization is then used to minimize g ( θ ) over Θ , subject to feasibility constraints that reject degenerate extractions. All feasible configurations are collected and sorted in ascending order of g ( θ ) . The K best configurations, denoted θ ( 1 ) , , θ ( K ) , are retained as seeds. In the second phase, each seed defines a local discrete neighborhood N θ ( k ) Θ by restricting each coordinate to nearby candidate values. Surrogate optimization is executed within each neighborhood to maximize a stability-aware objective computed on resampling splits of the merged training and validation data. The external test split remains excluded from the search and is used only for final reporting. Let MCC ( r ) ( θ ) denote the validation MCC obtained on repetition r from an internal stratified split of the merged set. The phase-two fitness is defined by
    fitness ( θ ) = MCC ¯ ( θ ) λ std MCC ( r ) ( θ ) , MCC ¯ ( θ ) = 1 R r = 1 R MCC ( r ) ( θ ) ,
    where λ 0 controls the variability penalty and R is the number of repetitions. The final configuration is the maximizer of the phase-two objective across all neighborhoods, with MCC ¯ ( θ ) used as the primary criterion and the penalty term used to prefer stable solutions when mean values are similar.
  • Figure 4 provides a graphical overview of the complete pipeline. The diagram follows the eight steps described above: the input retinal patch enters the intensity field construction (Step 1), passes through percentile thresholding (Step 2) to produce the binary mask (Step 3), from which runs are extracted with minimum-length constraints (Step 4) and long-run structure is computed (Step 5). The resulting 32-dimensional descriptor (Step 6) is standardized and fed to the ridge classifier (Step 7), whose hyperparameters are selected through the two-phase surrogate optimization (Step 8). At each stage, the figure shows representative inputs and outputs so that the transformation from patch to decision can be traced visually.

3.1. Pseudocode for the Proposed Pipeline

To make the method easier to reproduce, Algorithm 1 presents the complete procedure in pseudocode form. The algorithm receives the dataset, the discrete search space, and the optimization budgets as inputs. It first splits the data into training, validation, and test sets. Phase one then evaluates T 1 configurations sampled by the TPE surrogate in minimization mode, retaining the K configurations with the smallest generalization gap. Phase two defines a local neighborhood around each seed and runs T 2 additional surrogate-guided evaluations in maximization mode using repeated internal cross-validation. The configuration with the highest stability-aware fitness is selected, and the final ridge model is trained on the merged training and validation sets and evaluated once on the held-out test set.
Algorithm 1 Run descriptor extraction and two-phase surrogate optimization
  • Input: dataset { ( A i , y i ) } i = 1 N , discrete search space Θ , integer K, phase one budget T 1 , phase two budget T 2 , repetitions R, penalty λ
  • Split data into training set T , validation set V , test set E using stratified sampling
  • Define procedure Descriptor that maps a patch A and configuration θ to x R 32 using Steps 1 to 6
  • Define procedure FitScore that standardizes descriptors on a fit set, fits ridge, and returns MCC on requested sets
  •  
  • Phase one search
  • Initialize empty list L
  • for  t = 1 to T 1  do
  •       Sample θ t Θ using surrogate optimization in minimization mode
  •       Compute descriptors X T = { D ESCRIPTOR ( A , θ t ) : A T } and X V analogously
  •       if feasibility constraints fail then
  •             Continue
  •       end if
  •       Compute MCC tr ( θ t ) and MCC val ( θ t ) using FitScore
  •        g ( θ t ) MCC tr ( θ t ) MCC val ( θ t )
  •       Append ( θ t , g ( θ t ) ) to L
  • end for
  • Sort L by g ( θ ) in ascending order
  • Select seeds θ ( 1 ) , , θ ( K ) as the first K configurations in L
  •  
  • Phase two refinement
  • Initialize best configuration θ and best value F
  • for  k = 1 to K do
  •       Define a local neighborhood N θ ( k ) Θ
  •       for  t = 1 to T 2  do
  •             Sample θ t N θ ( k ) using surrogate optimization in maximization mode
  •             Compute descriptors on merged set M = T V
  •             if feasibility constraints fail then
  •                  Continue
  •             end if
  •             Generate R internal stratified splits of M into fit and validation subsets
  •             Compute MCC ( 1 ) ( θ t ) , , MCC ( R ) ( θ t ) using FitScore on each split
  •              MCC ¯ ( θ t ) 1 R r = 1 R MCC ( r ) ( θ t )
  •              fitness ( θ t ) MCC ¯ ( θ t ) λ std MCC ( r ) ( θ t )
  •             if  fitness ( θ t ) > F  then
  •                   θ θ t , F fitness ( θ t )
  •             end if
  •       end for
  • end for
  •  
  • Final training and test evaluation
  • Fit ridge on merged set M using θ and evaluate once on test set E
  • Output: selected configuration θ and test metrics
To clarify how the regular expression constraints translate into a concrete descriptor, consider a single row of the 32 × 32 binary mask, for example the sequence s = 0 0 1 1 1 1 1 0 0 0 0 0 0 1 1 0 . With a minimum one-run length of m 1 = 4 , the pattern 1 { 4 , } matches the first block of five consecutive ones but rejects the shorter block of two ones. Similarly, 0 { 6 , } with m 0 = 6 retains only zero-runs of at least six symbols. The matched runs yield the statistics described in Step 4: maximum run length, run count, and total run length per line. These values are computed for every row and every column, for both ones and zeros, producing the 32-dimensional descriptor defined in Step 6. When this descriptor is passed to the ridge classifier, the linear decision function directly weights run-level summaries, so the contribution of each structural pattern can be inspected at the descriptor level.

Leakage-Aware Grouped Evaluation Protocol

Because multiple patches can originate from the same retinal fundus image, the revised evaluation distinguishes the original repeated patch-level benchmark from a complementary leakage-aware grouped protocol. The main repeated benchmark is retained for the 100 execution summary and the comparative results, whereas the grouped analysis was added as an additional source–image disjoint robustness check. The grouped dataset contains 211 patches from 47 source images.
Three grouped evaluations are reported as complementary robustness analyses. First, an illustrative grouped holdout split uses 30 source images for training, 8 for validation, and 9 for test, corresponding to 147, 32, and 32 patches, respectively. Second, a 100-run grouped repeated holdout analysis quantifies variability under source–image disjoint resampling. Third, grouped repeated cross-validation and grouped nested cross-validation are used to assess validation overfitting and to compare two-phase TPE, one-phase TPE, and random search under stricter source–image separation.
Whenever comparative deep or handcrafted baselines could not be reconstructed with a source–image mapping, those results continue to be interpreted within the patch-level benchmark and are not presented as direct grouped comparisons.
The evaluation metrics used for the proposed method and the comparative models are defined below.

3.2. Evaluation Metrics

For binary classification with known ground truth, predictions fall into four categories: true positive ( T P ), false positive ( F P ), true negative ( T N ), and false negative ( F N ). Let P denote the total number of positive samples and N the total number of negative samples. The following metrics are then defined:
recall = T P P , precision = T P T P + F P .
Recall measures the fraction of positive samples that are detected correctly, whereas precision measures the fraction of predicted positives that are correct. These metrics are useful when the main priority is to recover positive cases, even at the cost of false positives. When the goal is to distinguish two lesion classes and to assess performance on both, it is also useful to consider:
accuracy = T P + T N P + N , F 1 - Score = 2 T P 2 T P + F P + F N .
Accuracy measures the fraction of correctly classified samples in the full dataset, and the F1-score is the harmonic mean of recall and precision. Both incorporate information beyond the positive class alone. In imbalanced datasets, however, accuracy and F1-score can depend strongly on how the positive class is defined and may therefore favor solutions that fit the dominant class. For this reason, the phi coefficient, also known as the Matthews correlation coefficient (MCC), is additionally used:
MCC = ( T P · T N ) ( F P · F N ) ( T P + F P ) ( T P + F N ) ( T N + F P ) ( T N + F N ) .
Unlike the preceding metrics, MCC ranges from 1 to + 1 : + 1 denotes perfect classification, 1 denotes complete inverse classification, and 0 indicates performance no better than random. The last case occurs when the product of correct predictions is equal or close to the product of incorrect predictions, so that T P · T N F P · F N and the numerator approaches zero.

4. Results and Discussions

Experiments for the proposed method and the classical machine learning baselines were run on an Apple Silicon M1 system (Apple Inc., Cupertino, CA, USA) with 8 GB of RAM, whereas CNN and vision transformer models were run on two NVIDIA Tesla T4 GPUs (NVIDIA Corporation, Santa Clara, CA, USA) with 29 GB of RAM. All implementations used Python 3.11.8 and PyTorch 2.4.0.
The revised manuscript reports two complementary evaluation settings. The main benchmark remains the repeated stratified patch-level protocol used for the 100-execution summary and the comparative analysis in Table 1 and Table 2. In addition, source–image disjoint grouped analyses were added as leakage-aware robustness checks.
Table 2 summarizes the main performance metrics of all models under the same evaluation protocol.
For the proposed ridge classifier, AUROC and AUPRC were computed from the raw signed decision scores returned by the fitted model; these quantities are therefore interpreted only as score ranking summaries of the decision function.

4.1. Overall Performance of the Proposed Method

The main repeated execution summary is reported in Table 1, which is kept as the primary descriptive table of the manuscript. Table 1 reports descriptive statistics of the proposed method across 100 independent executions of the complete pipeline, each carried out on a different stratified partition of the full dataset into 60% training, 20% validation, and 20% test. The dataset itself, not the test set, is re-split each time, so the training, validation, and test subsets change from one execution to the next. The optimization procedure, including both surrogate phases, is then run from scratch on each partition, and the resulting model is evaluated once on the corresponding held-out test set. In this way, the statistics in the table capture two sources of variability simultaneously: the randomness introduced by different data partitions and the stochasticity of the surrogate search. This protocol gives a more realistic picture of expected performance than a single fixed split, especially under class imbalance, where MCC can shift with small changes in the confusion matrix even when precision and F1 remain stable.
Table 1 shows that accuracy and F1 remain consistently high across the 100 partitions, with standard deviations of 0.022 and 0.029, respectively. MCC ranges from 0.714 to 0.843, with a standard deviation of 0.045. This narrower spread relative to the other metrics reflects the sensitivity of MCC to small confusion matrix changes under limited data, since a test set of only 42 images means that a single additional misclassification can shift MCC by a larger margin than it shifts accuracy or F1. The curve-based and uncertainty analyses reported next provide further context for these observations.

4.2. Comparative Analysis

Table 2 is kept in the main text as the central comparative benchmark. To make the deep learning comparison more explicit, all CNN and transformer baselines used AdamW, batch size 16, weighted cross-entropy, and augmentation with 90 , 180 , and 270 rotations together with horizontal and vertical flips. The pretrained backbones used 224 × 224 inputs with ImageNet normalization. An additional scratch CNN reference benchmark is reported in the Supplementary Material. To contextualize the proposed performance against deep baselines, Figure 5 reports the training and validation loss trajectories of the comparative CNN and transformer architectures. These curves provide a direct view of optimization stability and generalization under the low-resolution ( 32 × 32 ) and limited-data regime.
Figure 5 shows that EfficientNetB0 and MobileNetV2 exhibit validation losses that remain in a narrow band during most of training, with training loss that oscillates or decreases only slightly. This pattern, despite data augmentation, points to limited learning capacity under the present low-resolution and small-sample conditions, which is consistent with the low MCC values reported for these two architectures in Table 2. DenseNet121 shows an abrupt increase in training loss while validation loss remains almost flat, which suggests instability during optimization, although its final MCC of 0.595 indicates that the model still extracts useful features from the augmented data.
In contrast, ConvNeXtTiny and NesT-Base show sustained decreases in both training and validation loss, with the smallest train–validation gaps among the five architectures evaluated. ConvNeXtTiny reaches an MCC of 0.697 after augmentation, which makes it the highest-performing deep baseline. NesT-Base, despite a comparatively simpler loss trajectory, achieves an MCC of 0.615, which confirms that transformer-based architectures can also learn from 32 × 32 patches under limited data. These loss trajectories help explain the downstream classification results and show that data augmentation substantially improves deep model performance on this dataset. However, this comparison is limited to the repeated patch-level benchmark of Table 2; it is not a source–image disjoint grouped comparison against the deep baselines.
The comparative results in Table 2 remain one of the central results of the manuscript. The grouped source–image analyses added in the revision are reported later as complementary robustness checks rather than as replacements for this benchmark. In addition to the deep and tree-based baselines, four handcrafted texture descriptors were included in the comparison: Local Binary Patterns (LBP), Gray-Level Co-occurrence Matrix features (GLCM, Haralick descriptors), a Gabor filter bank, and Histogram of Oriented Gradients (HOG). Recent evidence indicates that traditional machine learning pipelines with handcrafted features can remain competitive in biomedical imaging when training data is limited, while requiring far less computation [37,38]. These four descriptors were selected because they capture complementary texture properties and have been applied together for the classification of retinal pathologies in optical coherence tomography images [39]. Each descriptor was paired with the same ridge classifier used by the proposed method so that differences in performance can be attributed to the representation rather than to the classification stage.
Under the repeated patch-level protocol of Table 2, the proposed method achieved the highest MCC and macro-F1 among the evaluated models. Within this same benchmark, ConvNeXtTiny was the highest-performing deep baseline, with an MCC of 0.697, above DenseNet121 (0.595) and NesT-Base (0.615). EfficientNetB0 and MobileNetV2 remained in the low-MCC range despite augmentation, with values of 0.184 and 0.388, which suggests limited discrimination between the two lesion classes at this resolution under this protocol. Among the classical models, logistic regression and SVM reached MCC values above 0.6 without any augmentation, which indicates that the run-based descriptor captures discriminative structure that simpler classifiers can use directly. The handcrafted texture descriptors fell in the MCC range of 0.259 to 0.503, with LBP as the highest-performing handcrafted baseline. The proposed method exceeded ConvNeXtTiny by 0.146 MCC points in this repeated patch-level benchmark while requiring orders of magnitude less computation, as shown in Table 3.
From a deployment perspective, Table 3 reports training time and test time latency for all models and makes the computational tradeoffs between deep architectures and the proposed lightweight pipeline easier to judge.
In Table 3, the mean time per image was computed as the reported test time divided by the 42 images in each held-out test partition. As shown in Table 3, deep architectures require much longer training and test times under the repeated patch-level benchmark. The proposed approach reduces inference to deterministic feature extraction and a linear decision function, which yields low latency per image. The intermediate masks and feature families can also be inspected directly. The following results therefore report operating curve behavior and uncertainty, with AUROC and AUPRC interpreted only as ranking summaries of the signed ridge scores.

4.3. Discriminative Performance, Operating Curve Behavior, and Stability

Table 4 reports the global test-set metrics of the proposed method together with the corresponding 95% bootstrap confidence intervals.
For these ROC- and PR-based summaries, AUROC and AUPRC were computed from the signed ridge decision scores and are therefore reported only as ranking diagnostics of the decision function. Figure 6 presents the one-versus-rest ROC and precision–recall curves for Cotton Wool Spots and Drusen. The AUROC is 0.934 for both classes. The AUPRC is 0.854 for Cotton Wool Spots and 0.968 for Drusen.
The ROC curve (Figure 6a) is better when the curve departs from the diagonal and approaches the upper-left corner, since that indicates high true positive rates at low false positive rates. The similar AUROC values for both classes indicate that the score ranks positive cases comparably in Cotton Wool Spots and Drusen. The precision-recall curve (Figure 6b) is better when it stays close to the upper-right corner, since that indicates high precision and high recall simultaneously. In this case the curves differ more between classes, which is expected when the degree of class overlap is not the same for the two lesion types. The higher AUPRC for Drusen indicates that the classifier retrieves Drusen more cleanly across operating thresholds than it retrieves Cotton Wool Spots.
Figure 6 also includes micro- and macro-averaged summaries. The micro-averaged AUROC is 0.918 and the macro-averaged AUROC is 0.934. The stepwise shape of the curves is due to the small test set, since each sample changes the operating points discretely.
Figure 7 summarizes the mean ROC and precision–recall curves across repeated executions of the optimization pipeline.
Figure 7 shows that the mean ROC and precision-recall curves remain well above chance, although run-to-run variation is visible because the search space is discrete and the extracted features are sensitive to threshold and minimum-length parameters.
The same figure also shows the difference between the best single execution and the mean behavior across runs. The mean AUROC is 0.857 for both classes. The mean AUPRC is 0.907 for Drusen and 0.796 for Cotton Wool Spots.
Figure 8 reports bootstrap confidence intervals for the main test metrics and the variability across runs in the repeated evaluation protocol. The width of the MCC confidence interval is largely a consequence of the small test set rather than a specific weakness of the proposed method. For comparison, the same bootstrap procedure applied to NesT-Base (MCC = 0.615) yields a 95% confidence interval of approximately [0.333, 0.857], which is wider than the interval obtained for the proposed method. This confirms that any classifier evaluated on a test set of this size would produce broad confidence intervals for MCC, regardless of its underlying architecture.
Figure 8a quantifies uncertainty due to finite sample size: the bootstrap procedure resamples the test predictions with replacement and recomputes each metric, so the resulting intervals reflect how much each metric could change if a different test sample of the same size were drawn. Wider intervals, such as those observed for MCC and AUPRC, indicate that these metrics are more sensitive to the composition of the test set. Figure 8b shows a different source of variability: the dispersion introduced by re-running the complete optimization pipeline with different random seeds. Here, each box summarizes the distribution of a given metric across independent executions. Accuracy and balanced accuracy are more stable across runs, whereas MCC varies more because a single change in the confusion matrix can shift MCC substantially when the test set is small.

4.4. Additional Grouped Source–Image Robustness Analyses

Because multiple patches can arise from the same retinal fundus image, a complementary source–image disjoint evaluation was added as a leakage-aware robustness analysis. The grouped dataset contains 211 patches from 47 source images. The illustrative grouped holdout split used 147 patches from 30 source images for training, 32 patches from 8 source images for validation, and 32 patches from 9 source images for test. The test subset contained 23 Drusen patches and 9 Cotton Wool Spot patches.
Under this grouped protocol, the two-phase TPE search used only the training and validation partitions. After the final configuration was fixed, the test partition was evaluated once. The grouped confusion matrix was 22 1 1 8 , with rows denoting the true labels and columns the predicted labels in the order Drusen and Cotton Wool Spots. This yielded an MCC of 0.8454 , an accuracy of 0.9375 , and a macro F1 of 0.9227 . This grouped split is presented as an additional leakage-aware robustness check and does not replace the main repeated benchmark summarized in Table 1.
As a second grouped robustness analysis, the distribution across 100 source–image disjoint repeated holdout executions was also computed. Table 5 summarizes the resulting distribution of MCC, accuracy, and macro F1, thereby showing how much grouped holdout performance can vary across leakage-aware splits drawn at the source-image level.
Within this grouped 100-execution analysis, the validation-selected run reached a test MCC of 0.5807 , whereas the test oracle run reached 0.8454 . The difference of 0.2647 shows how strongly a favorable grouped split can change the narrative. These values are therefore used as complementary leakage-aware variability evidence rather than as replacements for Table 1.

4.5. Robustness Against Validation Overfitting

Because the dataset is small and the hyperparameter space is discrete, additional grouped safeguards were added to evaluate validation overfitting. First, the proposed representation was assessed under grouped repeated cross-validation by source image. Second, the two-phase TPE search was compared against one-phase TPE and random search under grouped nested cross-validation. Table 6 summarizes these grouped validation protocols so their test behavior can be compared directly under source-image control.
Grouped repeated cross-validation yielded a mean MCC of 0.5642 , a median of 0.5843 , and a 95% bootstrap confidence interval from 0.5122 to 0.6144 . Under grouped nested cross-validation, random search obtained the highest mean test MCC ( 0.5234 ), followed by one-phase TPE ( 0.4823 ) and two-phase TPE ( 0.4714 ). However, the Friedman test did not detect significant differences among the three search strategies (statistic = 2.7949 , p = 0.2472 ). Accordingly, the revision does not claim a statistically demonstrated advantage for the two-phase search under the grouped nested protocol.
These grouped analyses complement Table 1 and Table 2; they do not displace the main repeated benchmark or the main comparative table.

5. Conclusions

This paper presented a compact and computationally interpretable method for classifying retinal lesions in retinal fundus images by combining percentile thresholding, run-based descriptors defined through regular expression constraints, a two-phase surrogate optimization strategy, and ridge classification. Under the repeated patch-level benchmark used in the main comparative analysis, the proposed method achieved a mean MCC of 0.7829 ± 0.0448 , a mean accuracy of 0.9008 ± 0.0217 , and a mean F1-score of 0.8529 ± 0.0294 . The best execution reached an MCC of 0.8433 , an accuracy of 0.9286 , a macro F1 of 0.8966 , and a macro AUROC of 0.934 , with a mean inference time of 0.0013 s per image. Within that repeated patch-level comparative benchmark, the proposed method achieved the highest result in Table 2, with ConvNeXtTiny as the highest-performing deep baseline and logistic regression as the highest-performing non-ridge classical baseline. The grouped source–image analyses were incorporated only as leakage-aware robustness checks for the proposed pipeline; because matched grouped comparisons were not available for all deep baselines, the manuscript does not claim grouped superiority over deep learning. The interpretability analysis suggests that one-run coverage, one-run maxima, and long-run continuity are the descriptors most closely associated with the separation between the two lesion classes. Because the classes share color and intensity at low resolution, converting each patch to a binary field and then measuring contiguous spatial structure appears to capture useful discriminatory information under the present experimental conditions. In that sense, the proposed pipeline can be described as compact, computationally interpretable, and competitive on this small patch dataset, but these findings should still be read with appropriate caution. The main limitations of the method remain the irregular discrete search space, the sensitivity of the optimization process to parameter configuration, the limited dataset size, the small number of grouped source images, and the absence of an external validation cohort with the same lesion definition protocol. The present results should therefore not be interpreted as establishing generalizability beyond this dataset or as proving broad superiority over deep learning outside the specific benchmark conditions studied here. Future work should emphasize larger source–image and patient-level collections, external validation on independently acquired retinal lesion patches, and optimization procedures that preserve interpretability while improving stability under leakage-controlled evaluation.

Supplementary Materials

The following supporting information can be downloaded at: https://www.mdpi.com/article/10.3390/a19060440/s1, Figure S1: Representative true positives, false positives, true negatives, and false negatives; Figure S2: Qualitative failure modes of the ridge-based decision function; Figure S3: Distribution of ridge-classifier scores; Figures S4–S15: Feature analysis and interpretability of the run-based representation; Figures S16 and S17: Qualitative per-image explanation sheets for correct and incorrect predictions; Tables S1–S4: Descriptive statistics of component coverages and valid run lengths; Table S5: Extended deep learning reference benchmark; Table S6: Component-wise ablation results; Table S7: Alternative classifiers on the fixed descriptor.

Author Contributions

Conceptualization, R.A.G.-R., I.C.-A. and A.H.-A.; methodology, R.A.G.-R., I.C.-A. and A.H.-A.; software, R.A.G.-R.; validation, G.P.T.-S. and M.A.H.-G.; formal analysis, R.A.G.-R., I.C.-A., J.-M.L.-H. and A.H.-A.; investigation, R.A.G.-R. and I.C.-A.; resources, J.-M.L.-H., G.P.T.-S. and M.A.H.-G.; data curation, R.A.G.-R.; writing—original draft preparation, R.A.G.-R. and I.C.-A.; writing—review and editing, R.A.G.-R., I.C.-A. and A.H.-A.; supervision, I.C.-A., A.H.-A., J.-M.L.-H., G.P.T.-S. and M.A.H.-G.; project administration, I.C.-A., A.H.-A., J.-M.L.-H., G.P.T.-S. and M.A.H.-G. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

The study was conducted in accordance with the Declaration of Helsinki and was approved by the Local Research and Ethics Committee of the Department of Ophthalmology of the Unidad Médica de Alta Especialidad T1, Instituto Mexicano del Seguro Social (IMSS), under registration number R-2018-1001-128.

Informed Consent Statement

Patient consent was waived due to the retrospective nature of the study and because only anonymized retinal fundus images were used. All images were obtained from the Department of Ophthalmology of the Unidad Médica de Alta Especialidad T1, Instituto Mexicano del Seguro Social (IMSS), after authorization by the Local Research and Ethics Committee under registration number R-2018-1001-128. No personal identifiers or identifiable patient information were used in the analysis or included in the manuscript.

Data Availability Statement

The data supporting the findings of this study are not publicly available because they consist of clinical retinal fundus images from patients and are subject to ethical and privacy restrictions. Further inquiries may be directed to the corresponding author, subject to institutional and ethical approval.

Acknowledgments

This research has been funded by the Secretaría de Ciencia, Humanidades, Tecnología e Innovación de México (SECIHTI) under project IxM-SECIHTI No. 3097-7185.

Conflicts of Interest

The authors declare no conflicts of interest.

Abbreviations

The following abbreviations are used in this manuscript:
MEMacular Edema
DRDiabetic Retinopathy
CNNConvolutional Neural Network
UMAEHigh Specialities Medical Unit
RFIRetinal Fundus Images

References

  1. Musat, O.; Cernat, C.; Labib, M.; Gheorghe, A.; Toma, O.; Zamfir, M.; Boureanu, A.M. Diabetic Macular Edema. Rom. J. Ophthalmol. 2015, 59, 133–136. [Google Scholar] [PubMed]
  2. García-Layana, A.; Cabrera-López, F.; García-Arumí, J.; Arias-Barquet, L.; Ruiz-Moreno, J.M. Early and intermediate age-related macular degeneration: Update and clinical review. Clin. Interv. Aging 2017, 12, 1579–1587. [Google Scholar] [CrossRef] [Scilit]
  3. Zhang, J.; Zhang, J.; Zhang, C.; Zhang, J.; Gu, L.; Luo, D.; Qiu, Q. Diabetic Macular Edema: Current Understanding, Molecular Mechanisms and Therapeutic Implications. Cells 2022, 11, 3362. [Google Scholar] [CrossRef] [Scilit]
  4. Wang, W.; Lo, A.C.Y. Diabetic Retinopathy: Pathophysiology and Treatments. Int. J. Mol. Sci. 2018, 19, 1816. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  5. Morya, A.K.; Ramesh, P.V.; Nishant, P.; Kaur, K.; Gurnani, B.; Heda, A.; Salodia, S. Diabetic retinopathy: A review on its pathophysiology and novel treatment modalities. World J. Methodol. 2024, 14, 95881. [Google Scholar] [CrossRef] [Scilit]
  6. Georgescu, A.; Dascalu, A.M.; Stana, D.; Alexandrescu, C.; Bobirca, A.; Cristea, B.M.; Vancea, G.; Serboiu, C.S.; Serban, D.; Tudor, C.; et al. The Role of Inflammation in Diabetic Retinopathy in Patients with Type II Diabetes; Potential Therapeutic Perspectives. J. Mind Med. Sci. 2024, 11, 17–23. [Google Scholar] [CrossRef] [Scilit]
  7. Kowluru, R.A.; Santos, J.M.; Mishra, M. Epigenetic Modifications and Diabetic Retinopathy. BioMed Res. Int. 2013, 2013, 635284. [Google Scholar] [CrossRef] [Scilit]
  8. Shah, A.R.; Gardner, T.W. Diabetic retinopathy: Research to clinical practice. Clin. Diabetes Endocrinol. 2017, 3, 9. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  9. Nilay, A.; Thool, A.R. A Review of Pathogenesis and Risk Factors of Diabetic Retinopathy with Emphasis on Screening Techniques. Cureus 2022, 14, e31062. [Google Scholar] [CrossRef] [Scilit]
  10. Gettinger, K.; Lee, D.; Tomita, Y.; Negishi, K.; Kurihara, T. Diabetic Retinopathy, a Comprehensive Overview on Pathophysiology and Relevant Experimental Models. Int. J. Mol. Sci. 2025, 26, 9882. [Google Scholar] [CrossRef] [Scilit]
  11. Bikbova, G.; Oshitari, T.; Bikbov, M. Diabetic Neuropathy of the Retina and Inflammation: Perspectives. Int. J. Mol. Sci. 2023, 24, 9166. [Google Scholar] [CrossRef] [Scilit]
  12. Pillar, S.; Moisseiev, E.; Sokolovska, J.; Grzybowski, A. Recent Developments in Diabetic Retinal Neurodegeneration: A Literature Review. J. Diabetes Res. 2020, 2020, 5728674. [Google Scholar] [CrossRef] [Scilit]
  13. Viganò, I.; Galbiati, S.; Aragona, E.; Gabellini, D.; Lattanzio, R.; Pedon, V.; Basile, G.; Arrigo, A.; Bandello, F.; Zerbini, G. Diabetes-Driven Retinal Neurodegeneration: Its Role in the Pathogenesis of Diabetic Retinopathy. Biomedicines 2025, 13, 1328. [Google Scholar] [CrossRef] [Scilit]
  14. Markan, A.; Agarwal, A.; Arora, A.; Bazgain, K.; Rana, V.; Gupta, V. Novel imaging biomarkers in diabetic retinopathy and diabetic macular edema. Ther. Adv. Ophthalmol. 2020, 12, 2515841420950513. [Google Scholar] [CrossRef] [Scilit]
  15. Hayati, A.; Abdol Homayuni, M.R.; Sadeghi, R.; Asadigandomani, H.; Dashtkoohi, M.; Eslami, S.; Soleimani, M. Advancing Diabetic Retinopathy Screening: A Systematic Review of Artificial Intelligence and Optical Coherence Tomography Angiography Innovations. Diagnostics 2025, 15, 737. [Google Scholar] [CrossRef] [Scilit]
  16. Cheema, A.A.; Cheema, H.R. Diabetic Macular Edema Management: A Review of Anti-Vascular Endothelial Growth Factor (VEGF) Therapies. Cureus 2024, 16, e52676. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  17. Spaide, R.F.; Curcio, C.A. Drusen Characterization with Multimodal Imaging. Retina 2010, 30, 1441–1454. [Google Scholar] [CrossRef] [Scilit]
  18. Zhang, X.; Sivaprasad, S. Drusen and pachydrusen: The definition, pathogenesis, and clinical significance. Eye 2021, 35, 121–133. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  19. Quellec, G.; Charrière, K.; Boudi, Y.; Cochener, B.; Lamard, M. Deep Image Mining for Diabetic Retinopathy Screening. Med. Image Anal. 2017, 39, 178–193. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  20. Sundaram, S.; Selvamani, M.; Raju, S.K.; Ramaswamy, S.; Islam, S.; Cha, J.H.; Almujally, N.A.; Elaraby, A. Diabetic Retinopathy and Diabetic Macular Edema Detection Using Ensemble Based Convolutional Neural Networks. Diagnostics 2023, 13, 1001. [Google Scholar] [CrossRef] [Scilit]
  21. Nguyen, D.M.H.; Alam, H.M.T.; Nguyen, T.; Srivastav, D.; Profitlich, H.J.; Le, N.; Sonntag, D. Deep Learning for Ophthalmology: The State-of-the-Art and Future Trends. arXiv 2025, arXiv:2501.04073. [Google Scholar] [CrossRef] [Scilit]
  22. Parmar, U.P.S.; Surico, P.L.; Singh, R.B.; Romano, F.; Salati, C.; Spadea, L.; Musa, M.; Gagliano, C.; Mori, T.; Zeppieri, M. Artificial Intelligence (AI) for Early Diagnosis of Retinal Diseases. Medicina 2024, 60, 527. [Google Scholar] [CrossRef] [Scilit]
  23. Mutawa, A.M.; Alnajdi, S.; Sruthi, S. Transfer Learning for Diabetic Retinopathy Detection: A Study of Dataset Combination and Model Performance. Appl. Sci. 2023, 13, 5685. [Google Scholar] [CrossRef] [Scilit]
  24. Chavan, R.; Pete, D. Automatic multi-disease classification on retinal images using multilevel glowworm swarm convolutional neural network. J. Eng. Appl. Sci. 2024, 71, 26. [Google Scholar] [CrossRef] [Scilit]
  25. Ünver, H.M.; Kökver, Y.; Duman, E.; Erdem, O.A. Statistical Edge Detection and Circular Hough Transform for Optic Disk Localization. Appl. Sci. 2019, 9, 350. [Google Scholar] [CrossRef] [Scilit]
  26. Almotiri, J.; Elleithy, K.; Elleithy, A. Retinal Vessels Segmentation Techniques and Algorithms: A Survey. Appl. Sci. 2018, 8, 155. [Google Scholar] [CrossRef] [Scilit]
  27. García-Ramírez, R.A.; Gonzalez-Valadez, U.A.; Cruz-Aceves, I.; Hernández-Aguirre, A.; Trujillo-Sánchez, G.P.; Solorio-Meza, S.E.; Hernandez-González, M.A. Deep Belief Networks for Efficient Macular Edema Detection in Retinal Fundus Images. In Machine Learning Methods in Biomedical Field: Computer-Aided Diagnostics, Healthcare and Biology Applications; Moya-Albor, E., Ponce, H., Brieva, J., Gomez-Coronel, S.L., Torres, D.R., Eds.; Springer Nature: Cham, Switzerland, 2026; pp. 79–107. [Google Scholar] [CrossRef] [Scilit]
  28. García-Ramírez, R.A.; Cruz-Aceves, I.; Hernández-Aguirre, A.; Trujillo-Sánchez, G.P.; Hernandez-González, M.A. Evolutionary-Driven Convolutional Deep Belief Network for the Classification of Macular Edema in Retinal Fundus Images. J. Imaging 2025, 11, 123. [Google Scholar] [CrossRef] [Scilit]
  29. Aslanyürek, C.; Yerlikaya, T. Automatic Regular Expression Generation for Extracting Relevant Image Data from Web Pages Using Genetic Algorithms. IEEE Access 2024, 12, 90660–90669. [Google Scholar] [CrossRef] [Scilit]
  30. Wang, Y.; Shi, Y.; Yang, T.; Wang, W.; Sun, Z.; Zhang, Y. Structural Performance Warning Based on Computer Intelligent Monitoring and Fractional-Order Multi-Rate Kalman Fusion Method. Fractal Fract. 2026, 10, 186. [Google Scholar] [CrossRef] [Scilit]
  31. Tan, M.; Le, Q.V. EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks. arXiv 2020, arXiv:1905.11946. [Google Scholar] [CrossRef] [Scilit]
  32. Dong, K.; Zhou, C.; Ruan, Y.; Li, Y. MobileNetV2 Model for Image Classification. In Proceedings of the 2020 2nd International Conference on Information Technology and Computer Application (ITCA), Guangzhou, China, 18–20 December 2020. [Google Scholar] [CrossRef] [Scilit]
  33. Chen, T.; Guestrin, C. XGBoost: A Scalable Tree Boosting System. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining; ACM: New York, NY, USA, 2016; pp. 785–794. [Google Scholar] [CrossRef] [Scilit]
  34. Huang, G.; Liu, Z.; Van Der Maaten, L.; Weinberger, K. Densely connected convolutional networks. In Proceedings—30th IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2017, Honolulu, Hi, Hawaii, 21–26 July 2017; IEEE: New York, NY, USA, 2017; pp. 2261–2269. [Google Scholar] [CrossRef] [Scilit]
  35. Zhang, Z.; Zhang, H.; Zhao, L.; Chen, T.; Arik, S.O.; Pfister, T. Nested Hierarchical Transformer: Towards Accurate, Data-Efficient and Interpretable Visual Understanding. arXiv 2021, arXiv: 2105.12723. [Google Scholar] [CrossRef] [Scilit]
  36. Liu, Z.; Mao, H.; Wu, C.Y.; Feichtenhofer, C.; Darrell, T.; Xie, S. A ConvNet for the 2020s. arXiv 2022, arXiv:2201.03545. [Google Scholar] [CrossRef] [Scilit]
  37. Chechekhina, E.; Voloshin, N.; Solopov, M.; Tyurin-Kuzmin, P.; Kulebyakin, K. Traditional machine learning in biomedical image analysis: Before you go too deep. Front. Artif. Intell. 2026, 9, 1695230. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  38. Buvat, I.; Dutta, J.; Jha, A.K.; Siegel, E.; Yousefirizi, F.; Rahmim, A.; Bradshaw, T. Should end-to-end deep learning replace handcrafted radiomics? Eur. J. Nucl. Med. Mol. Imaging 2025, 52, 4360–4363. [Google Scholar] [CrossRef] [Scilit]
  39. de Moura, J.; Vidal, P.L.; Novo, J.; Rouco, J.; Penedo, M.G.; Ortega, M. Feature definition and comprehensive analysis on the robust identification of intraretinal cystoid regions using optical coherence tomography images. Pattern Anal. Appl. 2021, 25, 1–15. [Google Scholar] [CrossRef] [Scilit]
Figure 1. Anatomical mapping of a retinal fundus showing the temporal, nasal, superior, and inferior regions, together with the fovea, macula, and optic disc. The diagram provides the spatial reference used throughout the manuscript and includes representative examples of microhemorrhages and hard exudates to situate lesion appearance within the retinal anatomy. Not to scale.
Figure 1. Anatomical mapping of a retinal fundus showing the temporal, nasal, superior, and inferior regions, together with the fovea, macula, and optic disc. The diagram provides the spatial reference used throughout the manuscript and includes representative examples of microhemorrhages and hard exudates to situate lesion appearance within the retinal anatomy. Not to scale.
Algorithms 19 00440 g001
Figure 2. Representative patches from the two lesion classes. (a) Cotton Wool Spots patches, showing diffuse or irregular bright lesions under limited local context; (b) Drusen patches, showing smaller rounded bright deposits with similarly low-resolution surrounding structure. Together, the examples illustrate the low resolution of the data, the overlap in color and intensity between classes, and the presence of vessels and other anatomical structures that make patch-level discrimination difficult.
Figure 2. Representative patches from the two lesion classes. (a) Cotton Wool Spots patches, showing diffuse or irregular bright lesions under limited local context; (b) Drusen patches, showing smaller rounded bright deposits with similarly low-resolution surrounding structure. Together, the examples illustrate the low resolution of the data, the overlap in color and intensity between classes, and the presence of vessels and other anatomical structures that make patch-level discrimination difficult.
Algorithms 19 00440 g002
Figure 3. Spatial distribution of the annotated lesion patches in the retinal fundus images. (a) Heatmap of Cotton Wool Spots annotations across the retinal field; (b) heatmap of Drusen annotations across the same field. Each heatmap accumulates the positions of the 32 × 32 labels in the database, so warmer regions indicate more frequent annotations. The resulting distributions suggest that Cotton Wool Spots are more frequently observed toward peripheral regions, whereas Drusen tend to appear with greater concentration near the central retinal area.
Figure 3. Spatial distribution of the annotated lesion patches in the retinal fundus images. (a) Heatmap of Cotton Wool Spots annotations across the retinal field; (b) heatmap of Drusen annotations across the same field. Each heatmap accumulates the positions of the 32 × 32 labels in the database, so warmer regions indicate more frequent annotations. The resulting distributions suggest that Cotton Wool Spots are more frequently observed toward peripheral regions, whereas Drusen tend to appear with greater concentration near the central retinal area.
Algorithms 19 00440 g003
Figure 4. Graphical overview of the proposed pipeline, indicating the correspondence with Steps 1–8. From left to right: the retinal patch input, intensity field and percentile thresholding, binary mask construction, run extraction with minimum-length constraints, long-run detection, descriptor assembly, and the two-phase surrogate optimization that selects the hyperparameters for the final ridge classification.
Figure 4. Graphical overview of the proposed pipeline, indicating the correspondence with Steps 1–8. From left to right: the retinal patch input, intensity field and percentile thresholding, binary mask construction, run extraction with minimum-length constraints, long-run detection, descriptor assembly, and the two-phase surrogate optimization that selects the hyperparameters for the final ridge classification.
Algorithms 19 00440 g004
Figure 5. Training and validation loss trajectories for the comparative deep architectures across epochs under the common low-resolution evaluation protocol. Panels (ae) correspond to ConvNeXtTiny, DenseNet121, EfficientNetB0, MobileNetV2, and NesT-Base, respectively, allowing a direct comparison of optimization stability, train–validation gap, and convergence behavior.
Figure 5. Training and validation loss trajectories for the comparative deep architectures across epochs under the common low-resolution evaluation protocol. Panels (ae) correspond to ConvNeXtTiny, DenseNet121, EfficientNetB0, MobileNetV2, and NesT-Base, respectively, allowing a direct comparison of optimization stability, train–validation gap, and convergence behavior.
Algorithms 19 00440 g005
Figure 6. One-versus-rest operating characteristic curves for the best configuration selected on the test set. Panel (a) shows the ROC curves for Cotton Wool Spots and Drusen together with the micro- and macro-averaged summaries. Panel (b) shows the corresponding precision–recall curves.
Figure 6. One-versus-rest operating characteristic curves for the best configuration selected on the test set. Panel (a) shows the ROC curves for Cotton Wool Spots and Drusen together with the micro- and macro-averaged summaries. Panel (b) shows the corresponding precision–recall curves.
Algorithms 19 00440 g006
Figure 7. Mean operating characteristic curves across repeated executions of the optimization pipeline. Panel (a) shows the mean one-versus-rest ROC curves with variability bands across runs, and Panel (b) shows the analogous precision–recall curves.
Figure 7. Mean operating characteristic curves across repeated executions of the optimization pipeline. Panel (a) shows the mean one-versus-rest ROC curves with variability bands across runs, and Panel (b) shows the analogous precision–recall curves.
Algorithms 19 00440 g007
Figure 8. Bootstrap confidence intervals and variability across runs for the proposed method. Panel (a) shows 95% bootstrap confidence intervals for the main evaluation metrics, and Panel (b) shows variability across repeated runs of the optimization process.
Figure 8. Bootstrap confidence intervals and variability across runs for the proposed method. Panel (a) shows 95% bootstrap confidence intervals for the main evaluation metrics, and Panel (b) shows variability across repeated runs of the optimization process.
Algorithms 19 00440 g008
Table 1. Descriptive statistics of the proposed method across 100 independent executions, each using a different stratified partition of the dataset. Each row summarizes the distribution of the corresponding metric over the 100 held-out test evaluations.
Table 1. Descriptive statistics of the proposed method across 100 independent executions, each using a different stratified partition of the dataset. Each row summarizes the distribution of the corresponding metric over the 100 held-out test evaluations.
MetricMinMaxMeanMedianStd. Dev.
MCC0.71440.84330.78290.78260.04475
Accuracy0.85710.92860.90080.90480.02174
F1-Score0.81250.89660.85290.84620.02939
Precision0.72221.0000.85250.86190.06912
Recall0.78570.92860.86190.85710.06746
Table 2. Model Performance Metrics.
Table 2. Model Performance Metrics.
ModelAccuracyF1-ScoreRecallmcc
EfficientNetB0 [31]0.62790.59050.59480.1839
HOG0.67440.50000.50000.2586
Random Forest0.73580.70160.73580.3654
GLCM (Haralick)0.74420.47620.35710.3658
MobileNetV2 [32]0.65120.64810.70440.3884
Gabor0.74420.56000.50000.3889
XGBoost [33]0.75470.73630.75470.4189
LBP0.79070.64000.57140.5026
DenseNet121 [34]0.81400.79520.80670.5946
SVM0.83020.82600.83020.6108
NesT-Base [35]0.83020.81740.83020.6154
Logistic Regression L20.83020.83290.83020.6409
ConvNeXtTiny [36]0.86050.86260.86050.6972
Proposed Method0.92860.89660.92860.8433
Table 3. Computation times of the evaluated models in seconds.
Table 3. Computation times of the evaluated models in seconds.
ModelTraining TimeTest TimeMean Time per ImageStd. Dev.
ConvNeXtTiny82.28756.82260.07790.0036
DenseNet121145.582918.69040.08400.0029
EfficientNetB0108.122611.00210.07600.0030
MobileNetV264.66407.09570.07340.0029
NesT-Base44.12160.56600.02100.0027
GLCM (Haralick)0.00190.0003<0.0001
Gabor0.00180.0002<0.0001
HOG0.01120.0004<0.0001
LBP0.02330.0003<0.0001
SVM0.03710.01610.00100.0001
Logistic Regression L20.16570.00220.00070.0001
Proposed Method0.23050.05760.00130.0003
Random Forest1.88240.02620.02440.0011
XGBoost9.38860.00140.00050.0001
Table 4. Test-set performance of the proposed method with 95% bootstrap confidence intervals.
Table 4. Test-set performance of the proposed method with 95% bootstrap confidence intervals.
MetricValueCIlowCIhigh
MCC0.8430.6411.000
Accuracy0.9290.8331.000
Macro F10.8970.8161.000
Weighted F10.9280.8441.000
Balanced Accuracy0.9110.8021.000
AUROC (macro)0.9340.8371.000
AUPRC (macro)0.9110.7921.000
Table 5. Grouped repeated holdout results across 100 source–image disjoint executions, reported as complementary robustness statistics.
Table 5. Grouped repeated holdout results across 100 source–image disjoint executions, reported as complementary robustness statistics.
MetricMeanStd. Dev.MedianMinMax
MCC0.47480.16070.4697−0.12600.8454
Accuracy0.75920.09530.76420.43750.9375
Macro F10.71600.09450.72160.41820.9227
Table 6. Robustness analysis under grouped repeated and grouped nested validation.
Table 6. Robustness analysis under grouped repeated and grouped nested validation.
ProtocolSearch StrategyMean MCCMedian MCC95% CI MCCMean Macro F1
Grouped repeated cross-validationProposed representation0.56420.58430.5122–0.61440.7549
Grouped nested cross-validationTwo-phase TPE0.47140.51380.3833–0.54850.7112
Grouped nested cross-validationOne-phase TPE0.48230.45570.4310–0.53290.7082
Grouped nested cross-validationRandom search0.52340.56370.4596–0.58560.7263
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

García-Ramírez, R.A.; Cruz-Aceves, I.; Hernández-Aguirre, A.; Lopez-Hernandez, J.-M.; Trujillo-Sánchez, G.P.; Hernandez-González, M.A. Surrogate-Based Optimization of Interpretable Regular Expression Patterns for the Classification of Retinal Lesions in Retinal Fundus Images. Algorithms 2026, 19, 440. https://doi.org/10.3390/a19060440

AMA Style

García-Ramírez RA, Cruz-Aceves I, Hernández-Aguirre A, Lopez-Hernandez J-M, Trujillo-Sánchez GP, Hernandez-González MA. Surrogate-Based Optimization of Interpretable Regular Expression Patterns for the Classification of Retinal Lesions in Retinal Fundus Images. Algorithms. 2026; 19(6):440. https://doi.org/10.3390/a19060440

Chicago/Turabian Style

García-Ramírez, Rafael A., Ivan Cruz-Aceves, Arturo Hernández-Aguirre, Juan-Manuel Lopez-Hernandez, Gloria P. Trujillo-Sánchez, and Martha A. Hernandez-González. 2026. "Surrogate-Based Optimization of Interpretable Regular Expression Patterns for the Classification of Retinal Lesions in Retinal Fundus Images" Algorithms 19, no. 6: 440. https://doi.org/10.3390/a19060440

APA Style

García-Ramírez, R. A., Cruz-Aceves, I., Hernández-Aguirre, A., Lopez-Hernandez, J.-M., Trujillo-Sánchez, G. P., & Hernandez-González, M. A. (2026). Surrogate-Based Optimization of Interpretable Regular Expression Patterns for the Classification of Retinal Lesions in Retinal Fundus Images. Algorithms, 19(6), 440. https://doi.org/10.3390/a19060440

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop