# Artificial Intelligence-Based System for Retinal Disease Diagnosis
## 2 Materials and Methods
### Fuzzy Model and Rule-Based Decision Making  
Mathematical modeling based on the fuzzy logic method is to solve the problem of diagnosing retinal pathologies. The mathematical theory of fuzzy sets and fuzzy logic is a generalization of classical set theory and formal logic. The initial data obtained in the traditional way (expert assessments) are converted into the values of linguistic variables (fuzzification). Then, fuzzy inference procedures are implemented on a set of production rules that make up the knowledge base of the control system, resulting in the formation of output linguistic values that are converted into the exact values of the calculation results (defuzzification). The implementation of the fuzzy modeling process is carried out using the specialized Fuzzy Logic Toolbox package of the MATLAB R2021b software. Fuzzy inference is implemented based on the Mamdani algorithm. To solve the problem of making decisions on diagnostics of retinal pathologies using the fuzzy logic method, its qualitative description is required based on linguistic expressions (logical rules). It is necessary to enter input  
Figure 4: Factors for detecting retinal pathology. and output variables. In relation to the problem being solved, it is necessary to enter 43 linguistic variables into the rule base, which are divided into three types in accordance with the classification given above: socio-demographic data (I1, I2), data obtained from the anamnesis, including subjective (I3-I15) and data obtained by recording bio-electrical signals, objective (I16-I39). There are four output variables--these are diagnoses and their stages (O1-O4). Linguistic variables and the range of their values are shown in Table 1. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Variable** & **Description** & **Value** & **Range of Value** \\ \hline \multicolumn{4}{c}{Input Variables} \\ I1 & Age & \(<\)20, 21–40, 41–60, 61–80, \(>\)81 & (0; 0.1; 0.2), (0.125; 0.25; 0.375), (0.325; 0.45; 0.575), (0.525; 0.65; 0.775), (0.725; 0.85; 1) \\ I2 & Gender & woman, man & (0; 0.3; 0.6), (0.4; 0.7; 1) \\ I3 & Diabetes & \(1\), 2, not diagnosed & (0; 0.2; 0.4), (0.3; 0.5; 0.7), (0.6; 0.8; 1) \\ I4 & Duration of diabetes, years & \(<\)5.5–10, 10–15, \(>\)15 & (0; 0.15; 0.3), (0.2; 0.35; 0.5), (0.4; 0.55; 0.7), (0.6; 0.8; 1) \\ I5 & Vision acuity & normal, under normal & (0; 0.3; 0.6), (0.4; 0.7; 1) \\  & Floaters in the eye, difficulty & & \\  & reading, surgical interventions, & & \\  & complaints of photopia, & & \\ I6–I10, I12, I13, I15 & detachment in the fellow eye, eye & yes, no & (0; 0.3; 0.6), (0.4; 0.7; 1) \\  & trauma, & & \\  & cardiovascular pathologies, night & & \\  & blindness & & \\ I11 & Refraction & normal, myopia & (0; 0.3; 0.6), (0.4; 0.7; 1) \\ I14 & Hereditary factor & yes, no, not defined & (0; 0.2; 0.4), (0.3; 0.5; 0.7), (0.6; 0.8; 1) \\ I16 & Maximum ERG, b-wave & normal, slightly decreased, & (0; 0.15; 0.3), (0.2; 0.35; 0.5), \\  & amplitude & increased, not registered & (0.4; 0.55; 0.7), (0.6; 0.8; 1) \\  & Peak latency of b-wave, peak & & \\  & latency of a-wave of maximal & & \\  & ERG, peak latency of a-wave of & & \\  & cone ERG, latency of P1 and & & \\  & latency of N1 of mf-ERG, time of & & \\  & N35, P50, N95 of PERG, latency of & & \\  & a-wave of local ERG & & \\  & Maximum ERG, a-wave & & \\  & amplitude, a-wave amplitude of & & \\  & cone ERG, b-wave amplitude of & & \\ I18, I20, I22, I24, I28, I33, I34, I35, I39 & & & \\  & nerve liability, oscillatory & & \\  & potentials, rhythmic ERG & & \\  & amplitude at 30 Hz, b-wave & & \\  & amplitude of local ERG & & \\  & Rod ERG, b-wave amplitude, & & \\  & retinal density P1 mf-ERG, N1 & & \\  & mf-ERG amplitude, a-wave & & \\  & amplitude of local ERG & & \\  & Electrical sensitivity threshold & & \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Ling istic variables and range of their values. The structure of the fuzzy model structure with input variables I1...I39 and output variables O1...O4 is shown in Figure 5.