0% found this document useful (0 votes)
17 views9 pages

Automatic Cough Detection Based On Airflow Signals For Portable Spirometry System1

This document presents a novel automatic cough detection algorithm for the AioCare portable spirometry system, utilizing only airflow signals rather than audio recordings. The algorithm was trained and validated using data from the AioCare system and the NHANES database, achieving high performance metrics including 0.86 sensitivity and 0.91 accuracy. This work represents the first fully reproducible cough detection method based solely on airflow signals implemented in a commercial spirometry system.

Uploaded by

Mohan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views9 pages

Automatic Cough Detection Based On Airflow Signals For Portable Spirometry System1

This document presents a novel automatic cough detection algorithm for the AioCare portable spirometry system, utilizing only airflow signals rather than audio recordings. The algorithm was trained and validated using data from the AioCare system and the NHANES database, achieving high performance metrics including 0.86 sensitivity and 0.91 accuracy. This work represents the first fully reproducible cough detection method based solely on airflow signals implemented in a commercial spirometry system.

Uploaded by

Mohan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Informatics in Medicine Unlocked 18 (2020) 100313

Contents lists available at ScienceDirect

Informatics in Medicine Unlocked


journal homepage: http://www.elsevier.com/locate/imu

Automatic cough detection based on airflow signals for portable


spirometry system
�ski a, Michał Łepek a, *, Łukasz Kołtowski b
Mateusz Solin
a
Faculty of Physics, Warsaw University of Technology, Koszykowa 75, 00-662, Warsaw, Poland
b
1st Department of Cardiology, Medical University of Warsaw, Zwirki
_ i Wigury 61, 02-091, Warsaw, Poland

A R T I C L E I N F O A B S T R A C T

Keywords: We give a short introduction to cough detection efforts that were undertaken during the last decade and we
Cough describe the solution for automatic cough detection developed for the AioCare portable spirometry system. In
Spirometry contrast to more popular analysis of sound and audio recordings, we fully based our approach on airflow signals
Cough detection
only. As the system is intended to be used in a large variety of environments and different patients, we trained
Machine learning
and validated the algorithm using AioCare-collected data and the large database of spirometry curves from the
NHANES database by the American National Center for Health Statistics. We trained different classifiers, such as
logistic regression, feed-forward artificial neural network, support vector machine, and random forest to choose
the one with the best performance. The ANN solution was selected as the final classifier. The classification results
on the test set (AioCare data) are: 0.86 (sensitivity), 0.91 (specificity), 0.91 (accuracy) and 0.88 (F1 score). The
classification methodology developed in this study is robust for detecting cough events during spirometry
measurements. As far as we know, the solution presented in this work is the first fully reproducible description of
the automatic cough detection algorithm based totally on airflow signals and the first cough detection imple­
mented in a commercial spirometry system that is published.

1. Introduction exhalation) [3].


Recently, much effort has focused on developing pocket, mobile peak
A cough can be described as a sudden, and often repetitively flow meters and spirometers with the same or similar functionality to
occurring, air expulsion with a forceful expiratory effort. The cough stationary clinical spirometers expanding the accessibility of this type of
reflex is initiated by irritation of cough receptors in the airways [1]. As a monitoring (e.g., Ref. [4,5]). These systems are designed to perform
consequence, nerve impulses from the cough center in the brainstem spirometry measurements with no supervision of physicians or with the
stimulate the diaphragm, intercostal muscles and larynx to produce the supervision of a physician with limited experience (including general
explosive expiration of cough. Cough often reflects respiratory irritation practitioners). Therefore, they need automatic real-time algorithms that
or illness and can also occur as an early symptom of asthma, cystic can detect the cough accurately and efficiently and warn the user in case
fibrosis or chronic obstructive pulmonary disease (COPD) [1,2]. of incorrect measurement.
Patients suffering from chronic pulmonary diseases should be regu­ The cough detection issue has been exhaustively explored. The
larly monitored to evaluate the progress of disease or treatment. A growth of computing power allows the analysis of cough signals in real-
common method for diagnosing and monitoring of pulmonary functions time using smartphones or dedicated hardware. Most of the research
is spirometry. However, patients with COPD frequently complain of was related to audio (sound) signals [6–23] or accelerometer recordings
breathlessness and cough, which are usually increased during exacer­ [24,25], which remains in contrast to our contribution. In our solution,
bations. On the other hand, a spirometry maneuver needs physical effort we do not analyze the sound but the airflow signal passing through the
from the patient and can cause irritation of airways that results in cough spirometer; thus, the troublesome influence of environmental noise is
during the examination. Spirometry standards require that correct largely minimized. The main purpose of developing cough detection and
spirometry maneuvers do not contain cough and are free of cough ar­ segmentation algorithms described in the literature was monitoring a
tifacts (especially in the first second after the beginning of the forced patient’s cough over time and counting cough occurrences [6–17]. Some

* Corresponding author.
E-mail addresses: [email protected] (M. Soli�
nski), [email protected] (M. Łepek).

https://doi.org/10.1016/j.imu.2020.100313
Received 4 February 2020; Received in revised form 6 March 2020; Accepted 7 March 2020
Available online 12 March 2020
2352-9148/© 2020 The Authors. Published by Elsevier Ltd. This is an open access article under the CC BY license (http://creativecommons.org/licenses/by/4.0/).
M. Soli�
nski et al. Informatics in Medicine Unlocked 18 (2020) 100313

of the research was dedicated to assessing the degree of pathology for maneuver. As the system is intended to be used in a large variety of
patients suffering from cystic fibrosis [18], to detect cold [19], tuber­ environments (clinical and in-home) and by both physicians and pa­
culosis [20] or COPD [21]. There were several studies on the relevance tients themselves, the cough detection algorithm we present in this work
of different sensors for cough detection (e.g., ECG sensor, thermistor, is developed to be accurate and robust and is tested on a large dataset of
chest belt, oximeter) [26,27] but no airflow sensor was investigated. spirometry airflow recordings. Attention is also paid to the need for the
With the constant reduction of the size of electronic equipment, there high specificity of the algorithm to avoid negative consequences of
are attempts to develop a wearable cough detection system [17,28,29]. incorrect classification as a cough that could cause the unjustified need
A very recent idea is to make use of smartwatches for ambulatory cough of repeating the measurement or user’s discouragement.
monitoring [30]. The identification of common respiratory disorders The organization of the article is as follows. In Section 2 the database
using cough sounds becomes a clinical tool [31]. Advanced mathematics used for training and validation of the algorithm is briefly described.
is also exploited recently to increase the performance of cough detection Preprocessing methods are outlined in Section 3. Section 4 provides an
algorithms, this is e.g. using octonions (octets of real numbers) [32] or overview of analytical methods adapted to construct the algorithm. The
so-called Hu moment invariants from image processing domain [33]. machine learning algorithms used in this work are presented in Section
The interesting fact is that cough detection was applied not only for 5. Their results are shown in Section 6. The discussion and summary are
human patients but also for veterinary monitoring of farm animals [34, given in Sections 7 and 8.
35].
Most of the literature is related to cough detection in audio (sound) 2. Data and preparation
signals rather than in flow signals. There are different purposes and
different methods in detecting cough in audio and flow signals. Cough The part of the data for the research was obtained from the National
detection in audio signals is used for monitoring cough in time, counting Health and Nutrition Examination Survey (NHANES) database by the
cough events, diagnosing patients basing on long-term cough observa­ American National Center for Health Statistics [40]. It is a free data
tions. It usually uses spectral features to analyze audio recordings. source containing raw spirometry curve data and additional information
Portable and wearable forms of cough detection always use audio (or about the examinations. Spirometry testing procedures of the NHANES
accelerometer) signals. In turn, cough detection in flow signals is used database met the recommendations of the American Thoracic Society.
mainly in spirometry. Only one single spirometry maneuver is then Three subsets of the database covering years 2007-2012 were used [41].
analyzed and assessed. The purpose of this is to improve the quality of The patients were both males and females from 6 to 79 years old. Ac­
spirometry examinations and helping spirometry patients in self- cording to the NHANES documentation, participants eligible for
monitoring (as well as helping inexperienced physicians or medical spirometry performed an initial first test spirometry examination. Then,
staff) by automatic maneuver assessment [36]. The signals to be if certain criteria were met, a subset of participants performed a second
analyzed in this case, are short and (generally) non-periodic. The cough test spirometry examination after inhaling a β2-adrenergic bronchodi­
detection in airflow signals for spirometry was undertaken in Ref. [37] lator. Multiple individual spirometry curves were typically obtained
where the authors tried to automatically detect the most important during both test spirometry examinations. The dataset contains the raw
spirometry user errors. They used heuristic features and decision tree signals for all of these individual spirometry curves. While the majority
models but the description seems to be too brief as only some of the of spirometry studies collected in NHANES are of high quality, some
features are described and model parameters are not mentioned. There spirometry curves may show defects such as extra breaths, a cough, a
is also another interesting work dealing with cough airflow signals [38]. back extrapolated volume error (BEV error) or a false start to the expi­
In this case, however, the purpose was not cough detection but ratory maneuver. These curves are divided into 4 subsets (A-D) in the
analyzing voluntary cough signals and predicting whether the full NHANES database where subset A contains the curves of acceptable
spirometry parameters of a given patient would be above or below the quality, B – curves with a large time to peak flow or a non-repeatable
lower limit of normality. peak flow, C – curves that had either less than 6 s of exhalation or no
Although cough detection seems to be examined from many different plateau, and D contains cough and BEV error curves. Thus, the cough
perspectives, reviewing the literature one realizes the low number of containing curves were extracted from the D-labeled examinations by 4
patients that produced the records for the dataset, usually not exceeding experienced human experts to create the dataset of two classes:
a dozen, sometimes up to several dozens of subjects. In some cases, each ATS-acceptable and other error curves versus cough curves. Examples of
subject produced several cough samples or the recordings of subjects the ATS-acceptable and cough containing maneuvers are shown in
were divided into numerous segments. Therefore, the numerical results Fig. 1.
presented by the authors may not be always entirely accurate if rescaled Although NHANES data is massive, the cough detection algorithm
for larger or more diverse sets of patients; as such, they may present trained on that data is to run on the signals collected using the AioCare
limited usefulness and reliability, especially in a broad clinical or com­ spirometer, hence, the signal collecting devices are different and signal
mercial application. Algorithms for automatic airflow cough detection properties may differ (e.g., the sensitivity of airflow sensors, level of
are implemented in some stationary spirometers, but, the manufacturers noise). Moreover, during the preliminary analysis of the NHANES
do not disclose data on performance or detection methodologies of their dataset, it has been found that there are very few non-cough signals with
solutions, therefore, no data is available for comparative analysis. PEF of 1.5 L/s or lower. To improve the reliability of the NHANES-
In this work, we describe the solution for automatic cough detection trained and tested algorithm on AioCare-collected curves, the second
developed for the AioCare spirometry system (HealthUp, Poland) [39]. data set containing 8,939 curves was obtained from AioCare measure­
The system consists of three main elements: portable spirometer (class ments during FVC maneuvers. These signals were obtained from the
IIa medical device), the mobile application for smartphone and Internet AioCare database containing the results from the healthy and diagnosed
cloud to store the data. During the measurement, the airflow signal is patients suffering from asthma and COPD (with age ranging from 7 to
transmitted from the spirometry device to the mobile application where 80) and covered a wide range of PEF values (also <1.5 L/s). To the
it is analyzed by an algorithm. Clinically important parameters are AioCare additional data set, we have added 19 steady-flow signals
presented to the user, e.g., forced vital capacity (FVC), forced expiratory generated by Series 1120 Flow Volume Simulator by Hans Rudolph, Inc.
volume in the first second (FEV1), their ratio (FEV1/FVC), peak expi­ Adding curves of this specific kind to the AioCare data test set was to
ratory flow (PEF), etc. Similarly, if any technical errors occurred during ensure that the spirometry system will correctly recognize such signals
the maneuver they are shown to the user who can determine the cor­ as non-cough ones.
rectness of the examination and repeat the measurement if needed. The Finally, all data consisted of 19,832 spirometry curves. Table 1
presence of cough is one of the indicators of incorrectness of the presents an overview of the dataset. It was randomly divided into

2
M. Soli�
nski et al. Informatics in Medicine Unlocked 18 (2020) 100313

training (59%), validation (33%) and test (8%) subsets. The sampling
rate of all of the data (both NHANES and AioCare) was 100 Hz.

3. Data preprocessing

Before extracting features and supplying them to the algorithms,


some preprocessing of raw data is needed. These preprocessing steps are
to standardize the curves and to clean the region of interest from noise
and artifacts. These are performed automatically in the following order:

a. Segmentation of the forced exhale signal from the raw curve. It is


usual that the flow curve contains not only the forced exhale but also,
e.g., inhales before or after the main maneuver. The segmentation
covers the fragment from the starting point of forced exhale up to the
start of the first inhale (if occurs) that follows the main maneuver.
b. If the length of the forced exhale signal after the segmentation is
longer than 600 samples (6 s) it is cut down to 600 samples. Due to
the spirometry standard [3], a cough that occurs during the first
second is the most important as it can significantly change the FEV1
parameter. Cough occurring later than in 6th second has very little
impact on spirometry parameters (in most examinations the
exhaled-volume increase after 6 s is residual).
c. Zeroing all of the negative values in the signal. This operation has no
effect on extracting features as any of them analyzes the negative
part of the signal. However, it lowers the flow-span of the data and
zeroes the residual fragments of inhales if they were not entirely
extracted during the initial segmentation.
d. Filtering the signal with the moving average of the window length of
5 samples (i.e., 0.05 s). Slight filtering is applied to smooth the noise
and dispose of minor artifacts.
e. Preprocessing for steady-flow detection. This step recognizes
whether the signal is a steady flow signal characteristic for Flow/
Volume generator or calibration syringe measurements. The detec­
tion is based on testing how many of the samples in the segmented
exhalation signal differs from the signal median significantly. If this
number is low, then it can be assumed that the signal is a steady-flow
signal and not a cough (see Table 2 for pseudocode algorithm) and it
finishes the classification path for the signal.

4. Feature extraction

Several numerical features have been developed to characterize the


presence of cough in a single spirometry curve. The input of the machine
learning algorithm consists of 6 features of low computational effort,
extracted for each curve. These are:

a. The number of local maxima (spikes) that are longer than 0.05 s and
occurred after achieving peak expiratory flow (PEF) (see Fig. 2a).
The threshold of 0.05 s was determined to separate cough-relevant
local peaks from shorter fluctuating ones (noise). Please note that
the moving average filtration (applied in Section 3.d) smoothens but
usually does not remove peaks (or valleys) if they are clearly visible
before.
b. The number of local maxima (spikes) that occurred after achieving
PEF with the right-slope amplitude of more than 0.25 l/s (see
Fig. 2b). This feature counts the peaks that are distinguishable
enough from the background and can be markers of cough. The right-
slope amplitude is the amplitude between the peak maximum and
the first point in time where the first derivative of the signal changes
its sign, thus, where the signal starts to increase again.
c. The number of crossings of the signal with horizontal lines (in­
tersections) at 15%, 25%, 50% and 75% of PEF. In this way, four
Fig. 1. Exemplary spirometry maneuvers from the NHANES database: (a) separate features are calculated (see Fig. 2c), separately for each
correct ATS-acceptable maneuver; (b) curve containing a very clear cough horizontal line. In non-cough signals, the number of crossings for
occurrence; (c) curve containing a less manifested cough occurrence. each horizontal line (if any fluctuations are not present) is equal to 2.
This methodology, especially zero-crossing (intersections with x-

3
M. Soli�
nski et al. Informatics in Medicine Unlocked 18 (2020) 100313

Table 1
Data selection extracted from the NHANES database and data obtained from AioCare measurements used in the study.
Training set
NHANES AioCare NHANES þ AioCare

Total 8115 3604 11719


Cough 2570 174 2744
Non-cough 5545 3430 8975

Validation set

Total 2704 3766 6470


Cough 884 312 1196
Non-cough 1820 3454 5274

Test set

Total - 1643 -
Cough - 105 -
Non-cough - 1538 -

Table 2
Pseudocode algorithm for determining whether the signal is a steady-flow signal (preprocessing step
e). The main idea is to calculate the difference between the signal and its median. If the signal is
recognized as a steady-flow signal it is then labeled as non-cough one.

axis), is widely used in detecting fluctuations in signals from various the number of local maxima, 4.06 (3.80–4.35) for the number of
domains, e.g., in heart rate analysis for both electro- and phono­ crossings at 15%, 5.99 (5.49–6.54) for the number of crossings at 25%,
cardiograms [42–45]. 6.36 (5.76–7.03) for the number of crossings at 50%, and 3.58
(3.30–3.89) for the number of crossings at 75%. For instance, the odds
The features a–c are graphically outlined in Fig. 2. ratio for the number of spikes is 4.09. It means that increasing the
The correlation analysis of features is often useful to determine the number of spikes by 1 would increase the probability of finding a cough
relevance and similarity of these features. High correlation (positive or in this signal by a factor of 4.09. In this way, we proved (initially) that
negative) of a specific feature with data labels can indicate high use­ the selected features would extract information on cough and they could
fulness of this feature in further classification. On the other hand, one be beneficial if used for building the classifier.
should avoid processing features that are highly correlated (close to
unity) with each other as it increases the size of the input data and of the 5. Machine learning algorithms
model while not providing any additional information. At the beginning
of the research we have collected a set of features that could be possibly All input data (see Table 1) were mean- and standard deviation-
useful for cough classification (via brainstorming and from the litera­ normalized before processing to training models. Machine learning
ture). We have discarded the features that were highly correlated with models for the study were implemented in the R-Studio environment
other ones (correlation higher than 0.85). We have performed several (version, 1.1.4.5.6, R package version: 3.5.1). Several algorithms were
training and validation procedures similar to calculating the optimiza­ trained and tested to choose one of the highest numerical performance.
tion surface to obtain the final set of features used in the study. A cor­ These were: logistic regression (LR), feed-forward artificial neural
relation plot for the final features for this study is presented in Fig. 3. network (ANN), support vector machines (SVM) and random forest (RF).
Additionally, each feature was evaluated separately according to its F1 score was used as a metric to select optimal models during opti­
predictive ability using one-way logistic regression models. For each mization and to compare the results. The parameters of the machine
regression model, p-value and odds ratio values were calculated. For all learning models were as follows:
of the features, the p-value is lower than 0.05 which means that these
features are statistically significant when used to differentiate between a) ANN: Sigmoid function was used as a transfer function in the neuron
cough and non-cough sets of signals. As statistically significant, the model. The validation method was k-fold cross-validation (k ¼ 5).
features were analyzed (still separately) with the odds ratio method. The The number of neurons and the number of iterations were tuned by
odds ratios were calculated with confidence intervals as follows: 4.09 calculating several combinations of parameters (each combination
(95%CI: 3.85–4.34) for the number of spikes, 11.60 (10.52–12.78) for was run 100 times to obtain reliable statistics). The maximal number

4
M. Soli�
nski et al. Informatics in Medicine Unlocked 18 (2020) 100313

Fig. 2. Illustration of features derived from the exemplary spirometry curve. (a) Number of local maxima (spikes) that are longer than 0.05 s and occurred after PEF.
Subsequent spikes are marked with arrows and denoted with integer numbers. (b) The number of local maxima (spikes) occurred after achieving PEF with the right-
slope amplitude of more than 0.25 l/s. There are 3 peaks of interest marked with red dots and arrows. (c) The number of crossings of the signal with horizontal lines
(intersections) at 15%, 25%, 50% and 75% of PEF value. The intersections are marked with red dots. (For interpretation of the references to color in this figure
legend, the reader is referred to the Web version of this article.)

of iterations was fit to 60 and 7 hidden neurons were used. The


TP
optimization surface is depicted in Fig. 4 to visualize the optimiza­ Sensitivity ¼
TP þ FN
tion results.
b) LR: LR with k-fold cross-validation (k ¼ 10) was used. The loss
function was mean square error.
c) SVM: SVM with a radial-type kernel was used. Model parameters b. Specificity (or selectivity, precision) which measures correctly
were tuned using grid search among the following parameters: cost identified actual negatives:
of constraints violation (it is the ‘C’-constant of the regularization
term in the Lagrange formulation) and gamma parameter (kernel Specificity ¼
TN
parameter). The best parameters were 10 for cost and 0.5 for gamma. TN þ FP
d) RF: We used function based on Breiman’s RF algorithm for classifi­
cation and regression. The number of trees was fit to 400. The
number of predictors at each split was established by minimalization
c. Accuracy which measures the overall number of correctly classified
of mean square error and were selected as 2. As in the case of ANN,
samples:
the RF algorithm depends on the initial seed, thus, we have per­
formed 100 runs to obtain reliable statistics. TP þ TN
Accuracy ¼
TP þ TN þ FP þ FN
The final artificial neural network architecture is presented in Fig. 5.

6. Results
d. F1 score which the harmonic mean of the precision and recall:
Statistical measures used for estimating numerical results of the al­ 2⋅Sensitivity⋅Specificity
gorithms were: F1 ¼
Sensitivity þ Specificity

a. Sensitivity (or recall) which measures correctly identified actual where TP stands for true positive (correctly identified), TN – true
positives: negative (correctly rejected), FP – false positive (incorrectly identified),
FN – false negative (incorrectly rejected).

5
M. Soli�
nski et al. Informatics in Medicine Unlocked 18 (2020) 100313

Fig. 3. Correlation plot of features. Each row and


each column show the correlation with other features
or cough. The size and color of the circles are pro­
portional to the value of correlation (blue for positive
correlation). The number of local maxima with the
right-slope amplitude of more than 0.25 L at the
descending slope of the forced exhale signal (noO­
fLocalMax) has significant correlation with the num­
ber of spikes that are longer than 0.05 s at the
descending slope of the forced exhale signal (noOf­
Spikes), however, it does not exceed 0.8. The number
of crossings of the signal with a horizontal line at 75%
of the maximum (noOfCross75) is the feature of the
weakest correlation with another ones. (For interpre­
tation of the references to color in this figure legend,
the reader is referred to the Web version of this
article.)

Fig. 4. The optimization surface for the ANN classifier. The validation procedure was performed using the validation dataset, training time up to 150 iterations and
hidden neuron numbers from 1 to 15. The final architecture was 7 hidden neurons and 60 iterations.

The results for all of the methods are presented in Table 3. For all of more or less – similar results of performance. For both validation and
the algorithms, the accuracy is roughly similar, however, the other test data, the specificity of the algorithm is higher than the sensitivity
measures vary slightly. ANN achieved the highest scores for sensitivity which can be regarded as a positive property of the algorithm as the
and F1 score and it was further tested on the AioCare test set to check minimalization of the number of false-positives was one of the goals in
final performance. the process of algorithm development.
As can be seen in Table 3, all of the classifiers we tested, they gave – We also tried to calculate the performance of ANN using balanced

6
M. Soli�
nski et al. Informatics in Medicine Unlocked 18 (2020) 100313

Fig. 5. Diagram presenting the final ANN architecture with 6 inputs (I1-I6), 7 hidden neurons (H1-H7) and 1 output neuron (O1). Absolute values of weights of inter-
neuron connections are proportional to the thickness of the links. B1 and B2 are pictorial representations of the neuron biases.

training dataset. ROSE package [46,47] was used for generating syn­
Table 3
thetic data, i.e., creating new synthetic points from the minority class to
The results of training and classification on the validation and test sets. Although
increase its cardinality. The balanced training dataset contained 5907
the results on the validation set are very similar, ANN achieved the highest
non-cough cases and 5812 cough cases. The best performance obtained
scores for sensitivity and F1 and it was further tested on the AioCare test set with
for the validation set from grid analysis was achieved for 5 neurons and a satisfactory result. The confidence intervals are also presented in the table.
training time of 30 iterations (F1 ¼ 0.88, Sensitivity ¼ 0.83 and Speci­
Sensitivity Specificity Accuracy (95% F1 (95%CI)
ficity ¼ 0.92). This performance is slightly worse than in the case of
(95%CI) (95%CI) CI)
original data due to the decrease in sensitivity result.
Validation set (NHANES þ AioCare)
LR 0.756 0.969 0.929 0.849
7. Discussion (0.746–0.766) (0.965–0.973) (0.923–0.935) (0.841–0.858)
ANN 0.865 (0.857- 0.941 (0.935- 0.927 (0.921- 0.901 (0.894-
We scanned the misclassified samples for different classifiers and 0.873) 0.947) 0.933) 0.909)
found out that, in general, most of the misclassified samples are the same SVM 0.798 0.962 0.932 0.873
(0.789–0.808) (0.958–0.967) (0.926–0.938) (0.865–0.881)
samples. We think that this is understandable because the main impact RF 0.795 0.968 0.936 0.873
on the performance should be given by the choice of features, rather (0.785–0.805) (0.963–0.972) (0.930–0.942) (0.865–0.881)
than by the choice of classification model. All of the models we used are Test set (AioCare)
robust models widely used in machine learning and similar performance ANN 0.857 (0.840- 0.912 (0.898- 0.908 (0.894- 0.884 (0.868-
0.874) 0.926) 0.922) 0.899)
may be considered as good and it may mean that none of the models
were over-trained. In Fig. 6, we present correctly and incorrectly clas­
sified samples. There are two cases (false positive and false negative) application (to prevent situations when the user is informed of a cough
that were misclassified by all of the models (subfigures e and f). In the error while it did not occur in real). As the ATS standards require, a
first case, it is the spirometry maneuver that has been performed without cough-containing measurement shall be repeated, therefore false posi­
forced exhalation (low, not smooth, no well-defined maximum), thus, tive classifications (low specificity) would force unnecessary maneuvers.
the algorithm misclassified it as a cough as the values of features were We consider this feature as important for a real patient-friendly appli­
high. In the second case, the cough was classified as a non-cough curve. cation because false-positive information would discourage the patient
It is probably because most of the curve is smooth and non-cough from further maneuvers and examinations.
indeed, and the cough occurs only at the end of the maneuver (two The performance for the balanced dataset was worse than for the
narrow spikes). From a clinical point of view, these two cough spikes at original one. Using the balancing of the data, we lost the information
the end of the maneuver would not change FVC significantly, thus, some about the appearance frequencies, which is going to affect accuracy
physicians would probably accept such a maneuver as a usable one. metrics themselves, as well as production performance. The cough is
We compared our results to the results obtained in the preceding relatively rare during spirometry examinations but not extremely rare (i.
work [37] where the authors developed airflow-based cough detection e., <1% of all cases), thus, we believe that using original data was
as a part of the spirometry user-error detection. The comparison is reasoned. The difference in F1 value between these two approaches
shown in Table 4. Although the sensitivity of the competing algorithm is (unbalanced, original data versus balanced data using ROSE package)
higher, we report significantly higher specificity and, thus, higher was not very significant; similar performance can suggest that the model
overall F1 score. is not over-trained. Moreover, the values of the performance parameters
The resulting specificity of our algorithm is higher than sensitivity, obtained for the test data set are only a little lower than the ones for
which we found acceptable as the minimalization of false-positive factor validation set which seems to prove that the model has an acceptable
was the property of interest due to the functional needs of the ability to generalize.

7
M. Soli�
nski et al. Informatics in Medicine Unlocked 18 (2020) 100313

8. Summary There are still some curves that were misclassified by the algorithm,
however, most of these maneuvers contain small cough disturbances or
The detection of cough events in spirometry curves using airflow disturbances which can be similar to cough. Thus, the features
signals is a tricky task as the cough can be manifested not only in a very
clear way but also through small flow disturbances. On the other hand,
lots of disturbances can be caused by other processes than cough. We Table 4
adopted the NHANES database to make sure that the training data is as The final results of the classification algorithm developed in this work in com­
large and diverse as possible, however, we also used a large number of parison to the results from the competing work [37] dealing with errors in
AioCare-collected signals. The classification algorithm developed in this spirometry airflow signals. Although the sensitivity of the competing algorithm
study is a robust tool for detecting cough events during spirometry is higher, we report significantly higher specificity and, thus, higher overall F1
score.
measurements and outperforms the previously described approach.
Taking into account the full description and reproducibility of the al­ Competing work [37] Our results
gorithm, we think that our results can be regarded as a noteworthy step F1 score 0.865 0.884
forward in clinical and home monitoring in spirometry. The algorithm Sensitivity 91.9% 85.7%
we developed was implemented in the AioCare mobile application. Specificity 81.7% 91.2%

Fig. 6. Charts presenting correctly (a–d) and incorrectly (e, f) classified curves. In (e), the spirometry maneuver has been performed without forced exhalation (low,
not smooth, no well-defined maximum). High values of features caused the algorithm to incorrectly classify it as a cough. In (f), the algorithm misclassified the curve
as a non-cough one.

8
M. Soli�
nski et al. Informatics in Medicine Unlocked 18 (2020) 100313

developed in this study can be insufficient to distinguish these subtle [18] Drugman T, Urbain J, Dutoit T. Assessment of audio features for automatic cough
detection. In: Signal processing conference, 2011 19th European. IEEE; 2011.
cases. Further increase in performance and reliability will be the aim of
p. 1289–93.
the next works. Another possible extension could be modifying the al­ [19] Ferdousi B, et al. Cough detection using speech analysis. In: 2015 18th
gorithm to provide information on the time when cough occurred (e.g., international Conference on Computer and information technology (ICCIT). IEEE;
in the first second of exhalation) what can be useful for spirometry 2016. https://doi.org/10.1109/ICCITechn.2015.7488043.
[20] Botha GHR, et al. Detection of tuberculosis by automatic cough sound analysis.
quality assessment. Physiol Meas 2018;39(4):045005.
[21] Windmon A, et al. On detecting chronic obstructive pulmonary disease (COPD)
Ethical approval cough using audio signals recorded from smart-phones. In: 12th international
Conference on Health informatics; 2018. p. 329–38.
[22] Pramono R, Imtiaz S, Rodriguez-Villegas E. Automatic cough detection in acoustic
All procedures performed in studies involving human participants signal using spectral features. In: 41st annual international conference of the IEEE
were following the ethical standards of the institutional and national engineering in medicine and biology society (EMBC); 2019.
[23] Hoyos-Barcel� o C, et al. Evaluation in a real environment of a trainable cough
research committee and with the 1964 Helsinki declaration and its later monitoring app for smartphones. In: Henriques J, Neves N, de Carvalho P, editors.
amendments or comparable ethical standards. XV mediterranean conference on medical and biological engineering and
computing – MEDICON 2019. IFMBE proceedings. vol. 76. Cham: Springer; 2020.
[24] Mły�nczak M, Pariaszewska K, Cybulski G. Automatic cough episode detection using
Declaration of competing interest a vibroacoustic sensor. In: Engineering in medicine and biology society (EMBC),
2015 37th annual international conference of the IEEE. IEEE; 2015. p. 2808–11.
Łukasz Kołtowski is the inventor of AioCare and a shareholder of [25] Mohammadi H, et al. Automatic discrimination between cough and non-cough
accelerometry signal artefacts. Biomed Signal Process Contr 2019;52:394–402.
HealthUp. Mateusz Solin � ski and Michał Łepek are employed by
[26] Drugman T, et al. Objective study of sensor relevance for automatic cough
HealthUp. detection. IEEE J Biomed Health Inf 2013;17(3):699–707.
[27] Mahmoudi SA, et al. Sensor-based system for automatic cough detection and
Acknowledgements classification. In: ICT innovations conference; 2016.
[28] Amoh J, Odame K. DeepCough: a deep convolutional neural network in a wearable
cough detection system. In: Biomedical Circuits and systems conference (BioCAS).
The authors would like to thank the referees for their helpful com­ IEEE; 2015. IEEE 2015.
ments on the manuscript. [29] Elfaramawy T, et al. Wireless respiratory monitoring and coughing detection using
a wearable patch sensor network. In: New Circuits and systems conference
(NEWCAS), 2017 15th IEEE international. IEEE; 2017.
References [30] Liaqat D, et al. Towards ambulatory cough monitoring using smartwatches. Am J
Respir Crit Care Med 2018;197:A4929.
[1] Piirila P, Sovijarvi AR. Objective assessment of cough. Eur Respir J 1995;8: [31] Porter P, et al. A prospective multicentre study testing the diagnostic accuracy of
1949–56. https://doi.org/10.1183/09031936.95.08111949. an automated cough sound centred analytic system for the identification of
[2] Smith J, Woodcock A. Cough and its importance in COPD. Int J Chronic Obstr Pulm common respiratory disorders in children. Respir Res 2019;20:81.
Dis 2006;1(3):305–14. [32] Klco P, Kollarik M, Tatar M. Novel computer algorithm for cough monitoring based
[3] Standardization of Spirometry 2019 Update. An official American thoracic society on octonions. Respir Physiol Neurobiol 2018;257:36–41.
and European respiratory society technical statement. Am J Respir Crit Care Med [33] Monge-Alvarez J, et al. Robust detection of audio-cough events using local Hu
October 15, 2019;200(8). https://doi.org/10.1164/rccm.201908-1590ST. moments. IEEE J Biomed Health Inf 2018;23(1):184–96.
[4] Hofman A, Kupczyk M, Kuna P, et al. Application of the AioCare system in [34] Carpentier L, et al. Automatic cough detection for bovine respiratory disease in a
monitoring exacerbations of bronchial asthma. Pol J Allergol Spec Issues 2018;(1): calf house. Biosyst Eng 2018;173:45–56.
A.8. in Polish. [35] Guarino M, et al. Field test of algorithm for automatic cough detection in pig
[5] Goel M, Saba E, Stiber M, et al. Spirocall: measuring lung function over a phone houses. Comput Electron Agric 2008;62(1):22–8.
call. In: Proceedings of the 2016 CHI Conference on human Factors in computing [36] Kupczyk M, et al. Home self-monitoring in patients with asthma using a mobile
systems. ACM; 2016. p. 5675–85. spirometry system. accepted in J Asthma 6 Jan 2020. https://doi.org/10.1080/
[6] Larson EC, et al. Accurate and privacy preserving cough sensing using a low-cost 02770903.2019.1709864. published online.
microphone. In: Proceedings of the 13th international conference on ubiquitous [37] Luo AZ, et al. Automatic characterization of user errors in spirometry. In: 39th
computing. ACM; 2011. p. 375–84. annual international Conference of the IEEE Engineering in Medicine and biology society
[7] Di Perna L, et al. An automated and unobtrusive system for cough detection. In: Life (EMBC); 2017.
sciences conference (LSC). IEEE; 2017. p. 190–3. [38] Reynolds JS, et al. Classification of voluntary cough airflow patterns for prediction
[8] Amrulloh YA, et al. Automatic cough segmentation from non-contact sound of abnormal spirometry. IEEE J Biomed Health Inf 2016;20(3):963–9.
recordings in pediatric wards. Biomed Signal Process Contr 2015;21:126–36. [39] AioCare. The portable spirometry system by Healthup Sp. z o.o. website, www.ai
[9] Larson S, et al. Validation of an automated cough detection algorithm for tracking ocare.com (last access 1st Jan 2020).
recovery of pulmonary tuberculosis patients. PloS One 2012;7(10):e46229. [40] National Center for Health Statistics. National Health and nutrition examination
[10] You M, et al. Cough detection by ensembling multiple frequency subband features. Survey. website, https://wwwn.cdc.gov/Nchs/Nhanes/ (last access 11 January
Biomed Signal Process Contr 2017;33:132–40. 2019).
[11] Hoyos-Barcel� o C, et al. Efficient computation of image moments for robust cough [41] National Center for Health Statistics. NHANES data links, https://wwwn.cdc.gov/
detection using smartphones. Comput Biol Med 2018;100:176–85. Nchs/Nhanes/2007-2008/SPXRAW_E.htm; 11 January 2019. https://wwwn.cdc.
[12] You M, et al. Novel feature extraction method for cough detection using NMF. IET gov/Nchs/Nhanes/2009-2010/SPXRAW_F.htm. https://wwwn.cdc.gov/Nchs/Nh
Signal Process 2017;11(5):515–20. anes/2011-2012/SPXRAW_G.htm.
[13] Abramov GV, et al. Information system for diagnosis of respiratory system diseases. [42] K€ohler B-U, et al. QRS detection using zero crossing counts. Prog Biomed Res 2003;
J Phys Conf 2018;1015:042036. https://doi.org/10.1088/1742-6596/1015/4/ 8(3):138–45.
042036. [43] Grzegorczyk I, et al. PCG classification using a neural network approach. In:
[14] Pham C. MobiCough: real-time cough detection and monitoring using low-cost Computing in cardiology conference (CinC), 2016. IEEE; 2016. p. 1129–32.
mobile devices. In: Nguyen NT, Trawi� nski B, Fujita H, Hong TP, editors. Intelligent [44] Soli�
nski M, et al. Classification of atrial fibrillation in short-term ECG recordings
Information and database systems, ACIIDS, vol. 9621. Berlin, Heidelberg: Springer; using a machine learning approach and hybrid QRS detection. Computing 2017;44.
2016. Lecture Notes in Computer Science. [45] Mubarak Q, et al. Quality assessment and classification of heart sounds using PCG
[15] Vizel E, et al. Validation of an ambulatory cough detection and counting signals. In: Khan F, Jan M, Alam M, editors. Applications of intelligent technologies
application using voluntary cough under different conditions. Cough 2010;6(1):3. in healthcare, EAI/springer innovations in communication and computing. Cham:
[16] Birring S, et al. The Leicester Cough Monitor: preliminary validation of an Springer; 2019.
automated cough detection system in chronic cough. Eur Respir J 2008;31(5): [46] Lunardon N, Menardi G, Torelli N. ROSE: a package for binary imbalanced
1013–8. learning. R J. 2014;6(1):79–89.
[17] Kadambi P, et al. Towards a wearable cough detector based on neural networks. In: [47] Menardi G, Torelli N. Training and assessing classification rules with imbalanced
2018 IEEE international Conference on acoustics, Speech and signal processing data. Data Min Knowl Discov 2014;28:92–122.
(ICASSP). IEEE; 2018.

You might also like