Figure 4

Cough frequency monitoring algorithm used in this study. (A) Signal amplitude threshold, structure of variational autoencoder (VAE) and clustering for cough detection. Signal amplitude thresholds were set using data that were determined as coughs by the “labels”, and data units with an amplitude greater than the threshold were categorized into training datasets and test datasets. VAE, a machine learning algorithm with deep learning, consists of a network called an encoder and decoder and can automatically extract and learn multilevel features of coughs in the latent variable space. K-means clustering was used to determine whether the input data units were “cough units” or “non-cough units” from the latent variables. In short, the VAE built a feature extraction network using a training dataset and is clustered by the k-means algorithm. Then, based on the performance of the learned network and clustering results, the test dataset units were automatically labeled as cough or non-cough units. (B) Example of a clustering result in this study. Using the training data, the VAE extracted features of cough in the latent variable space (latent variables Z1 and Z2), and the results were clustered by the k-means algorithm. Based on this algorithm, the area within the red circle was defined as a cough cluster. Our algorithm was created by using Python 3.9 and PyTorch 1.5.1.