# Comparison of ANN and ANFIS Models for AF Diagnosis Using RR Irregularities
## 3 Results and Discussion  
The 120 ECG recordings taken by cardiologists in a hospital and having a time interval of 2.5 min were examined. P, QRS, and T waves were detected for each segment using the CWT technique. In the feature extraction process, _RR_ irregularities were transformed into variable _CV_, _MAD_, _RMSSD_, and _SAV_ features. The variables from NSR, PAF, and AF patients were considered different based on mean \(\pm\) standard deviation (SD), as shown  
Figure 4: ANFIS architecture with two rules. in Table 1 and the box plots in Figure 5. The mean and SD of the variables of NSR: PAF: AF for each variable were CV (0.11 \(\pm\) 0.09: 0.21 \(\pm\) 0.17: 0.34 \(\pm\) 0.22), MAD (4.57 \(\pm\) 5.76: 8.16 \(\pm\) 8.75: 14.19 \(\pm\) 7.78), RMSD (54.95 \(\pm\) 41.78: 81.56 \(\pm\) 55.06: 109.69 \(\pm\) 65.71), and SAV (4.73 \(\pm\) 4.43: 22.64 \(\pm\) 19.16: 253.40 \(\pm\) 323.40), respectively. Heartbeat is related to the \(RR\) interval that has a steady rhythm under normal conditions. Previous works have shown that \(RR\) irregularities in AF patients have more fluctuation and are more unstable than for PAF and NSR. The results from the local patient database of those with AF illustrated higher mean \(\pm\) SD values of all features than PAF, and PAF also showed higher mean \(\pm\) SD values than NSR, due to the irregularity of the \(RR\) intervals from ECG signals. The ECG recordings did not fit a normal distribution. Therefore, these data had to be transformed before being used for analysis. The results from the ANOVA tests showed that all features (\(CV\), \(MAD\), \(RMSSD\), and \(SAV\)) of NSR, PAF, and AF were statistically different in mean values, with a significance level of 0.05 at \(p\)-values less than 0.05. These variables could discriminate AF patients. From [PERSON]'s method, all pairs of NSR, PAF, and AF were \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Variable** & \(CV\) & \(MAD\) & \(RMSSD\) & \(SAV\) \\ \hline NSR (n = 40) & 0.11 \(\pm\) 0.09 & 4.57 \(\pm\) 5.76 & 54.95 \(\pm\) 41.78 & 4.73 \(\pm\) 4.43 \\ PAF (n = 40) & 0.21 \(\pm\) 0.17 & 8.16 \(\pm\) 8.75 & 81.56 \(\pm\) 55.06 & 22.64 \(\pm\) 19.16 \\ AF (n = 40) & 0.34 \(\pm\) 0.22 & 14.19 \(\pm\) 7.78 & 109.69 \(\pm\) 65.71 & 253.40 \(\pm\) 323.40 \\ ANOVA* (\(p\)-value) & 0.00 & 0.00 & 0.035 & 0.00 \\ \hline \hline \end{tabular} \({}^{*}\)Transformed data.  
\end{table} 
Table 1: Mean \(\pm\) standard deviation of variables and ANOVA test. Figure 5: Box plots of variables. different for all variables, as shown in Figure 6. These results have confirmed that all \(CV\), \(MAD\), \(RMSSD\), and \(SAV\) of NSR, PAF, and AF can be used as discriminate indicators. ANN and ANFIS were selected and applied to construct the best model, and 10-fold cross-validation was assured for the AF diagnosis model. The number of neurons in ANN varied from 10 to 100. For ANFIS models, triangular, trapezoidal, bell, gauss, and gauss2 membership functions were selected for testing in this research. All types of membership were set symmetrically, with 3-5 membership functions for each variable. The results of testing models are illustrated in Table 2. This research used ACC, SE, SP, and PPR to compare the performance results of the models, which showed that the ability of the model depended on the parameters applied in the model. The performance values of the best models of ANN and ANFIS were illustrated in Figure 7. The ANN with the highest hidden layers (100 hidden layers) performed the best among ANN with different hidden layers for all features. Only ANN(50) and ANN(100) for the SAV feature could obtain ACC above 80%. ANN(100) showed very good performance for classification. The classification of AF patients is a complex problem; a large number of hidden layers is necessary for ANN models. The ANFIS with trapezoidal membership functions was the best among the other membership functions for all variables. Moreover, most ANFIS_trapmf models of each variable were better than the ANN models in AF diagnosis.