Weighted Polynomial Approximation for Automated Detection of Inspiratory Flow Limitation

Inspiratory flow limitation (IFL) is a critical symptom of sleep breathing disorders. A characteristic flattened flow-time curve indicates the presence of highest resistance flow limitation. This study involved investigating a real-time algorithm for detecting IFL during sleep. Three categories of inspiratory flow shape were collected from previous studies for use as a development set. Of these, 16 cases were labeled as non-IFL and 78 as IFL which were further categorized into minor level (20 cases) and severe level (58 cases) of obstruction. In this study, algorithms using polynomial functions were proposed for extracting the features of IFL. Methods using first- to third-order polynomial approximations were applied to calculate the fitting curve to obtain the mean absolute error. The proposed algorithm is described by the weighted third-order (w.3rd-order) polynomial function. For validation, a total of 1,093 inspiratory breaths were acquired as a test set. The accuracy levels of the classifications produced by the presented feature detection methods were analyzed, and the performance levels were compared using a misclassification cobweb. According to the results, the algorithm using the w.3rd-order polynomial approximation achieved an accuracy of 94.14% for IFL classification. We concluded that this algorithm achieved effective automatic IFL detection during sleep.


Computational and Mathematical Methods in Medicine
Manual scoring of abnormal respiratory events is a timeconsuming task. A qualitative grading by visual inspection is more demanding than merely identifying IFL cycles [12]. Therefore, achieving automatic IFL recognition is a crucial task that necessitates resolution in clinical practice.
For automatic noninvasive assessment of IFL and related changes in UARS or OSA, the recognition of both airflow and intrathoracic pressure changes is required; this has been described in previous studies [13,14]. Various mathematical approaches have been proposed for reliably classifying IFL breaths using the esophageal pressure-flow relationship [2,[14][15][16]. Recently, several mathematical methods based on the peak, flatness, and roundness of the flow-time curve have been proposed for detecting IFL for autoadjusting positive airway pressure (auto-PAP) devices [17][18][19]. The theoretical considerations on the basis of which the relationship between flow and time can be characterized using a polynomial equation are presented in [16]. They demonstrate that a 3rd-order polynomial model is appropriate to fit an actual inspiratory flow. On the basis of this study, we hypothesized that a weighted polynomial approximation can effectively achieve classification of IFL.
This study investigated a real-time feature extraction algorithm for detecting IFL during sleep. We propose IFL detection methods involving weighted polynomial functions for IFL feature extraction. For comparative study, both the flatness index (FI) method and polynomial approximation were used for IFL detection. Vital insights into the ability of the proposed methods to automatically detect IFL were thereby obtained.

Development Set.
To evaluate the potential feature extraction metrics (or indicators) of IFL and to determine the best cut points for each metric, a development data set was obtained from previous studies [17,20] Clustering analysis was performed as described in the following section. Aittokallio et al. (2007) classified inspiratory airflow waveforms as non-IFL (normal), IFL Level 1 (mild), and IFL Level 2 (severe), which are labeled as "I," "△," and "×," respectively, in Figure 1 [17]. The data were collected from normal male subjects, normal female subjects, and male patients with OSAHS. The representative patterns of inspiratory flow shape were sorted into Classes 1-10, Classes 11-20, and Classes 21-40 using cluster analysis. Aittokallio et al. (2001) described seven categories, in which Classes 41-43 represented the classes with one, two, or three or more peaks; Classes 41 and 47 differentiate the sinusoidal class and the flat top flow limitation class; and Classes 44-46 provide further differentiation of the single-peak shapes regarding the presence and orientation of the flat part [20]. To quantify the degree of the midinspiratory flattening of the flow-time curve, we collected 47 classes of inspiratory flow shapes to obtain typical and representative single-period waveforms. These served as fundamental evidence of the extent of the three major inspiratory flow waveforms and provided a basis for estimation for characteristic analysis. Data created by time inversion were also collected. Thus, the learning samples consisted of inspiratory flow shapes from 94 breaths and were used to tune the parameters of our proposed algorithm. The distribution is illustrated in Figure 2(a).

Test Set.
Thirteen volunteers with OSAHS were recruited from the community. These volunteers underwent full nocturnal polysomnography (Alice5 5 Sleep System Advances Through Simplification, Philips) recordings using EEG, ECG, EOG, EMG, and Spo2 derived at a sample frequency of 256 Hz at the sleep center of Taipei Veterans General Hospital in Taipei, Taiwan. The study was approved by the Institutional Review Board of Taipei Veterans General Hospital, Taiwan (2012-11-001AC). Sleep stages were manually scored by experts using Rechtschaffen and Kales criteria. Apneas and other respiratory events were scored by applying standard criteria [21]. The respiratory signal was obtained using a nasal cannula device at a sampling frequency of 20 Hz and a low-pass filter with a cut-off frequency of 2 Hz was applied. Because the frequency content of a flow signal is located below 1 Hz [22], the applied 2 Hz filter can reduce the signal noise from snoring. In this study, inspiratory flow signals were used to detect flow limitation; the determination and normalization of inspiratory cycles are essential for auto-PAP devices. The procedure was as follows: (1) The actual respiratory flow signal provided by the nasal cannula device was recorded during sleep. Because breaths are connected in inspiratory-expiratory pairs, the expiratory parts were filtered to retain the inspiratory parts for IFL detection. The start of inspiration was marked by a switch from negative to positive flow (relative to the baseline). (2) Each inspiratory flow waveform amplitude was normalized to a range between 0 and 1. (3) Each inspiratory flow waveform duration was normalized to an interval between 0 and 1, with a total of 100 points. All respiratory flow waveforms were preprocessed according to the previously described normalization process.
Respiratory event-related arousal (RERA) is believed to be the characteristic event of OSA. Our test set was obtained from 13 OSA subjects either with or without RERA while sleeping. Their breathing cycles were analyzed as follows. Polysomnography was applied for prescoring to detect each subject's breathing-for 150 seconds prior to RERA or a nonrespiratory-event, and for 150 seconds subsequently, thereby obtaining a section containing non-IFL and IFL breathing cycles. A set of 2565 respiratory data was obtained from the 72 sections collected during sleeping. Subsequently, 1093 respiratory data items were selected from the set through subjective visual detection. Processing of visual detection was conducted as follows. For the separate processing of the non-IFL and IFL data, two physicians with more than 3 years of clinical experience assigned levels of 1-3 in accordance with their respective experience. We used three levels of certainty in our interviews, namely, (1) strongly negative, (2) balanced, and (3) strongly positive. The aim was to not exclude the influence of subjective judgment. Each physician was asked to judge the inspiratory flow following visual assessment and to note the IFL degree as a certainty value. The percentage of agreement was 89.3% between both physicians. The test  set created with classical non-IFL criteria consisted of 637 breaths and that with the IFL criteria consisted of 456 breaths (IFL Level 1 (363) and IFL Level 2 (93)), resulting in a total of 1,093 breaths being obtained by strong positive certainty. The distribution is illustrated in Figure 2(b).

Flatness Index.
A patented FI process [23] was used to calculate the inspiratory flow of patients during sleep to determine whether their respiration was abnormal. FI is used to treat SDB in various positive airway pressure devices [24]. It is calculated by the root-mean-square deviation from a unit-scaled flow, which is computed over the middle (50%) of a normalized inspiratory breath. A characteristic flattened flow-time curve indicates the highest resistance and the presence of flow limitation, whereas a rounded flow-time curve indicates lower resistance and the absence of flow limitation. A detected indication can acquire a value through the FI formula shown in the following: where is the inspiratory flow signal, is the mean of the inspiratory flow, and is the number of breaths. In this study, the value of is 1 because the flow-time curve relates only to a single breath. Flatness is determined by the absolute value of variance between 25% and 75% for the inspiratory flow from the average of all values in the same period. FI detects IFL at 50% of the middle area of an inspiratory signal. A normal inspiratory flow-time curve is rounded or quasi-sinusoidal. For this reason, it is easy to determine whether an inspiratory breath is normal or limited. Examples of FI detection are shown in Figure 3(a).

Polynomial Approximation.
To achieve rapid convergence and efficiency, the Levenberg-Marquardt (L-M) method was achieved for obtaining least-squares coefficient solutions. The polynomial models were used to fit the inspiratory flow data and to calculate the residues as feature extraction. Using the residuals, a receiver operator curve was produced to determine the threshold of non-IFL, IFL Level 1, and IFL Level 2 classifications.
Polynomial Approximation. The inspiratory flow signal may be in compliance with a -order linear equation [16,25,26]: The polynomial function ( ) is of exact degree if it is of degree and ! = 0, where the flow index has the following mathematical representation: Here, is the residual of feature extraction, ( ) is the residual of the th data point for the total points, ( ) is the measured inspiratory flow, and ( ) is the fitted response value. ( ) is a -order linear equation; 0 , 1 , 2 , 3 , and are constants; is the starting point of the sampling points; is the ending point of the sampling points; is each sampling point between and ; and ( ) is the amplitude of the inspiratory flow at the sampling point .
Weighted Polynomial Approximation. For our proposed method, the reference waveform may be in compliance with a -order weighted linear equation ( ) wherein the feature index has the following mathematical representation: Here, is the residual of feature extraction and ( ) is defined as where ( ) is the -order linear equation, is the starting point of the sampling points; is the ending point of the sampling points; is each sampling point between and ; ( ) is a weighting function; A, B, and are weighting factors; and ( ) is the amplitude of the normalized waveform at the sampling point .
Compared with the fitting effect of the -order linear equation, the -order weighted linear equation can further weight, for example, the starting point or the ending point of the normalized flow curve. This could adjust the end points of the curve from the -order weighted linear equation and reduce the error caused by the end points. In this study, the weighted -order linear equation cites only the starting and ending points. We suggest that the weighting factor " " ranges from 50 to 100, " " ranges from 200 to 400, and " " is 1. The default values of " " and " " are 50 and 200 units, respectively. The value of the weighting factors was determined from the development set and it did not change from patient to patient or breath to breath.

Statistical Analysis.
A receiver operator curve (ROC) was constructed for each index of feature extraction for the development set, and cut points were chosen to optimize the separation among the non-IFL, IFL Level 1, and IFL Level 2 groups. Sensitivity, specificity, and accuracy were then calculated. An optimal cut-off for separating subjects with and without IFL was then selected for each index of feature extraction to simultaneously maximize the sum of sensitivity and specificity. The two "best" metrics (maximum area under the ROC) were chosen from among the evaluated indices. The test set was then evaluated prospectively, using only the best indices.

Results of Accuracy Analysis.
According to the curvefitting results, the flow-time relationships of breaths were classified as non-IFL, IFL Level 1, and IFL Level 2, as shown in Figure 3. The rapid convergence and efficiency were conducted using the L-M method to minimize the sum of the residuals. In this study, IFL detection methods were investigated, as shown in Table 1. The accuracy of the classification of non-IFL, IFL Level 1, and IFL Level 2 in the development set was evaluated through the area under the curve (AUC) of an ROC. Predictions of AUC can be rated as acceptable (>0.7), excellent (>0.8), or outstanding (>0.9). Figure 2 shows the number of localities in each analytical class. The feature detection methods using the thirdorder and the weighted third-order (w.3rd-order) polynomial approximations demonstrated outstanding distinction performance for IFL classes. The feature detection methods using FI, the first-order polynomial approximation, and the second-order polynomial approximation provided excellent distinction for the IFL classes. According to the AUC shown in Figure 4, the best cuff-off values were available to classify the three IFL categories, as presented in Table 2. The experimental results of the development set are shown in Table 3. The classification of the non-IFL part-excluding the method of FI detection, which reached only 81.25%-could be trained to 93.75% accuracy. In the classification of the IFL Level 1 part, the detection methods using FI, the firstorder polynomial approximation, and the second-order polynomial approximation could be trained up to only 70% accuracy. In the classification of the IFL Level 2, excluding the detection methods using the first-order and 2nd-order polynomial approximations, all feature detection methods could be trained to more than 96% accuracy. Overall, the w.3rd-order polynomial approximation could reach 96.81% accuracy; furthermore, the third-order polynomial approximation reached up to 94.68% accuracy. Thus, we found that the feature detection methods using the 3rd-order and w.3rdorder polynomial approximations achieved much higher accuracy than the other feature detection methods.
The results of test sets for the five types of feature detection methods are shown in Table 4. The overall classification performance indicates that the feature detection method using the w.3rd-order polynomial approximation achieved the best accuracy (94.14%). Subsequently, the feature detection method using the third-order polynomial approximation achieved up to 89.66% accuracy. The FI feature detection method achieved only 78.68% accuracy. The feature detection methods using FI and the first-order polynomial approximation for non-IFL for the analysis of 1,093 breaths exhibited high accuracy (96.70% and 98.90%, resp.), but the accuracy for IFL classification was insufficient. Therefore, this result displays poor recognition for IFL classification. Moreover, IFL was unrecognized in the feature detection methods using the first-order and second-order polynomial approximations, which ultimately displayed accuracy levels of 29.75% and 27.82%, respectively. The sensitivity (true positive rate) and specificity (true negative rate) for each classification are also shown in Tables 3 and 4.

Comparison of Three-Class Classification Performance.
Cobweb representation is a method of performance assessment for multiclass classification [27]. Using a graphical representation in which each of the separate misclassifications represents one corner on a polygon, a visualization is used to analyze multiclass medical data [28]. In this work, cobweb representation based on the total number of misidentified breaths was used as comparative method of assessing threeclass classification performance. The proportion of accurately classified and misclassified samples obtained from the test set is presented in Table 4. The misclassified samples are used in cobweb representation. A chance classification with three classes represented with 1/3 (0.33) likelihood is given in Figure 5. The likelihood is generally used to compare the performance of any classifier with the chance classifier in terms of misclassification rates. In this study, we used cobweb representation to visualize the performance      Figure 5: Comparison of three-class misclassification rates for different feature extraction methods. The cobweb plot enables an intuitive comparison of the misclassification rates. Each axis ranges from 0 at the center (no misclassification) and extends outward to 1.0 (100% misclassification) and has been cropped from 0 to 0.5. For example, the axis "IFL Level 2 → IFL Level 1" refers to the percentage of subjects who were originally IFL Level 2 but misclassified as IFL Level 1 using the feature extraction method. The performances of each feature obtained from different methods are plotted in different colors. (a) FI, (b) w.3rd-order, (c) first-order, (d) second-order, and (e) third-order polynomial approximations.
of three-class classifiers on the test set. The performance evaluation shown in Figure 5 is a summary of the comparison of all five feature detection methods. As shown in the figure, the feature detection methods using the third-order and w.3rd-order polynomial approximations exhibited favorable performance. The six-dimensional points of the cobweb are less than 0.1 and less than the chance classifier. However, the feature detection method using the w.3rd-order polynomial approximation is superior to that using the 3rd-order polynomial approximation with respect to (IFL Level 1 → IFL 8

Computational and Mathematical Methods in Medicine
Level 2) misclassification. We also observed that the detection methods using FI, the first-order polynomial approximation, and second-order polynomial approximation showed higher accuracy than did the chance classifier in terms of (IFL Level 1 → NIFL) and (IFL Level 2 → IFL Level 1) misidentification.

Discussion
The detection of IFL is important in clinical practice involving SDB. Detecting the existence of IFL could not only verify diagnoses of SDB but also enable the supply of urgent airflow support to eliminate flow limitation and treat SDB. This study demonstrated that a real-time feature extraction algorithm based on previous feature classification and using weighted 3rd-order polynomial approximation can effectively identify IFL with a correction rate of up to 96.81%. This is unequivocally helpful in managing SDB. Regarding the automatic detection of the shape of airflow signals, auto-PAP devices have been used for several years to correct the flattened inspiratory flow in order and associate it with subtle upper airway obstruction [29,30]. Although auto-PAP devices are costlier than standard continuous PAP devices, they are useful for eliminating adverse respiratory events and improving subjective restfulness in specific situations such as home titration and detection of mouth leak. Auto-PAP devices constantly monitor a person's breathing and adapt to the best pressure setting throughout the night. However, auto-PAP technology relies on the determination of obstructive events characterized by IFL, apneas, and snoring to automatically adjust to different pressure settings. The pressure adjustment between low and high ranges is key to the success of auto-PAP devices in improving treatment adherence in patients with SDB. This study used two indicators-accuracy and misclassification-to assess classification performance. The main finding of this study is that the feature detection methods using FI and the first-and second-order polynomial approximations are weak. In addition, the feature detection methods using the third-order and w.3rd-order polynomial approximations were compared. Although the classification results were highly similar, the feature detection method using the w.3rdorder polynomial approximation achieved superior classification accuracy to that achieved by the method using the third-order polynomial approximation for IFL Level 1. In cobweb representation, the results reveal that the FI method, first-order polynomial approximation, and secondorder polynomial approximation yield highly similar results. All exhibit misclassification in the arm of [IFL1 → IFL2] and [IFL1 → NIFL]. The reasons for this may be that (1) the FI method and first-order polynomial approximation applying 50%-60% standard deviation of the IFL middle waveform as a characteristic value and (2) using the secondorder polynomial approximation can only indicate a turning point. It may describe a non-IFL waveform but can describe only the trend in the IFL waveform. That is, it cannot act as effective data of flow-limited breath for improving the classification. The second-order polynomial approximation is characterized by only one deflection. In other words, it does not approximate as closely as the first-order approximation (see Figure 3 for details). However, the thirdorder polynomial approximation is expected to provide a more accurate estimation of the flow-time relationship than the second-order polynomial approximation does for flow-limited breaths because it can be characterized by two deflections. Moreover, a two-deflection relationship can approximate the better measured flow-limited breaths in Levels 1 and 2. Therefore, in this study, a polynomial approximation combined with the weighted principal component is presented as a more effective method for classifying IFL waveforms. The polynomial approximation describes the flow-limited breaths as well as fixing at both ends of the data points and the maximum value with combination of the weight of the principal component. The application of auto-PAP to UARS is a suitable example of the effectiveness of our algorithm in improving auto-PAP. Currently, all types of auto-PAP devices are used in providing optimal ventilation therapy to SDB patients in clinical treatment. The key to effective treatment is firmware programming for assessing the degree of upper airway resistance [31]. UARS is often ignored in classical polysomnographic diagnostic approaches and misdiagnosed as simple snoring or idiopathic hypersomnia. There is still considerable disagreement on the type and level of respiratory abnormality that must be used as a "cut-off" for significant diseases (e.g., OSA syndrome and UARS). In a previous study [32], auto-PAP titration was applied to diagnose and treat patients with UARS to treat daytime sleepiness or somnolence. A useful noninvasive predictor of increased upper airway obstruction has been presented by the evaluation of the inspiratory flow shape. As mentioned, UARS is characterized by repeated arousal at night. However, we know that decreasing upper airway resistance is effective against UARS for patients treated with auto-PAP. The auto-PAP machine could reduce arousal. Hence, it must be assumed that the auto-PAP algorithm accurately detects the presence of flow limitation. Our proposed identification and classification of IFL can be used to facilitate the application of auto-PAP in early treatment. We are confident that it is easy to use and sufficient to detect IFL when using auto-PAP. In summary, our algorithm can assist auto-PAP in providing correct and effective pressure to prevent REMS or severe respiratory obstruction.
Previous studies by Aittokallio et al. [17,20] have described an automated method using inspiratory flow shape clustering for monitoring the functioning of the upper airway during sleep. In contrast, a reference training set for IFL data using this summarization approach was successfully applied in our work. This appears to be the first time that a reference set has been used to develop a model for estimating IFL. Furthermore, IFL shapes were classified into different levels (non-IFL Level 1, IFL Level 2 (mild), and IFL Levels 3 and 4 (severe)) [18,19]. In our study, the shapes of IFL were classified into just two levels. Mansour et al. [25,26] demonstrated a polynomial equation for determining flow limitation based on the pressure-flow relationship. In the present study we applied the w.3rd-order polynomial function using the flowtime relationship. Several limitations should be considered in interpreting our findings. First, the inspiratory flow shapes were visually classified breath-by-breath on one occasion. The test set involved a low number of actual respiratory flow shapes. The results of the sensitivity and specificity analysis were not compared with other functions, such as the quadratic function [25]. Finally, IFL with inspiratory snoring was not included in the analysis data.

Conclusion
In conclusion, the third-order algorithm demonstrated high performance for IFL detection. The w.3rd-order polynomial function significantly improved the population and was successfully applied for classification of severe IFL. This comparative study provides vital insights into the efficacy of automatic detection of IFL for reducing mean airway pressure, improving subjective sleepiness, and ensuring adherence to treatment in patients with mild SDB.

Ethical Approval
The study was approved by the Institutional Review Board of Taipei Veterans General Hospital, Taiwan.

Consent
Informed consent was obtained from all participants included in this study.

Disclosure
All procedures performed in this study involving human participants were in accordance with the 1964 Helsinki Declaration and its later amendments.