{'fraction_non_alphanumeric': 0.024897119341563786, 'fraction_numerical': 0.009670781893004115, 'mean_word_length': 4.912814274128142, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
HeartFit: An Accurate Platform for Heart Murmur Diagnosis Utilizing Deep Learning

Cardiovascular disease (CD) is the number one leading cause of death worldwide, accounting for more than 17 million deaths in 2015. Critical indicators of CD include heart murmurs, intense sounds emitted by the heart during periods of irregular blood flow. Current diagnosis of heart murmurs relies on echocardiography (ECHO), which costs thousands of dollars and medical professionals to analyze the results, making it very unsuitable for areas with inadequate medical facilities. Thus, there is a need for an accessible alternative. Based on a simple interface and deep learning, HeartFit allows users to administer diagnoses themselves. An inexpensive, custom designed stethoscope in conjunction with a mobile application allows users to record and upload audio of their heart to a database. Using a deep learning network architecture, the database classifies the audio and returns the diagnosis to the user. The model consists of a deep recurrent convolutional neural network trained on 300 prelabeled heartbeat audio samples. After the model was validated on a previously unseen set of 100 heartbeat audio samples, it achieved a f beta score of 0.9545 and an accuracy of 95.5 percent. This value exceeds that of clinical examination accuracy, which is around 83 percent to 91 percent and costs orders of magnitude less than ECHO, demonstrating the effectiveness of the HeartFit platform. Through the platform, users can obtain immediate, accurate diagnosis of heart murmurs without any professional medical assistance, revolutionizing how we combat CD.


I. INTRODUCTION
Heart murmurs can be innocent or pathologic. Pathologic murmurs are dangerous because they often are caused by structural defects of the heart such as cardiac shunts (holes), valve defects, or valve calcification (thickening) [5]. Different types of abnormal murmurs can be mapped to their cause based on how they occur during the cardiac cycle. The cardiac cycle is characterized by two phases, systole and diastole, separated by heart sounds, S1 and S2, caused by the closure of major valves. In a normal heart, there are two clear, distinct beats at S1 and S2. Murmurs can be classified as systolic or diastolic. Systolic murmurs begin at S1 and conclude at S2, while diastolic murmurs begin at S2 and end at S1 [8].
The differences between pathologic murmurs and normal heart sounds (including innocent murmurs) are often difficult to recognize, but taking into consideration of many factors can allow us to delineate them. The first of these factors is timing, specifically the position relative to S1 and S2, such as occurring in the systole or diastole phase [2,8]. The next is intensity, or amplitude or loudness of murmur [2,8]. Third is duration, the length of time murmur occurs [8]. Last is shape and quality, specifically the configuration of murmur and whether it is overlaid on other sounds [8]. Previous approaches tackled our problem in response to the 2016 Physionet Heart Murmur Classification Challenge using support vector machines, neural networks, and various forms of signal processing. However, the overall performance was low at best in the mid-80s percent range [10]. Thus, a new classification technique is needed for screening platforms to be accurate.
The neural network (NN) is a machine learning algorithm modeled after the brain composed of layers of neurons connected by synapses. Synapses have weights that change as data is propagated through the NN, allowing the NN to learn. Deep learning refers to NN with many layers, which increases accuracy and the ability to learn more features, making it an attractive choice for murmur classification [4].

A. Platform Design
In order to make our platform cheap, portable, and accessible to the public, we take advantage of the fact that most areas around the world have access to wireless, a mobile device, and a stethoscope, which usually costs below 15 dollars [6]. The platform classifies murmurs in 5 steps, as shown by the diagram below.
The specific materials used in the process of engineering this platform include Android Studio, Firebase (database), Keras with Tensorflow, Android Phone, Mac, USB Cable, and a Modified Stethoscope. The diagram below reveals how each of the different components of the process.
HeartFit serves many purposes. The first is to make murmur screening available to low-income areas that cannot afford ECHO. Second is to verify a doctors verdict on a murmur as a computer-aided screening tool. Third is to have the option of a murmur-monitoring system at home. Last is allowing people with no experience with murmurs to be able to recognize a murmur and act accordingly.
Our platform consists of three main parts: mobile application, database, and stethoscope. The goal was to make recording and uploading audio easy and the platform compatible with multiple users simultaneously. First is the mobile application, which was developed using Android Studio with Java. It consists of three parts: Registration/Login (personalized account synched with database), Profile (record and upload heart audio for screening), and History (access to previous screening results).
The next main part is the database, which not only transfers audio and results back and forth between the deep learning server and the app but also stores them so users and physicians can refer to them later.
The last central component of the HeartFit system is the stethoscope.We devised a process that would allow a common stethoscope to be attached to the app. This process begins with obtaining any stethoscope and cutting off earpiece, next inserting a phone mic into some connection tubing, insulating connection for best results, and lastly the option to substitute the engineered stethoscope with a more expensive electronic stethoscope for better results.

B. Deep Learning Architecture
Our deep learning architecture consists of three parts: transformation, preprocessing, and classification. The goal of transformation is to turn heart sounds into a form that can be analyzed by deep learning. Sound is a wave, so we chose to represent the recorded audio as a .wav file, a 1D graphical representation of the sound wave. Each unit of a .wav file corresponds to a specific segment of the wave, which contains a number that corresponds to the height of the wave at that instant. When the user begins recording, a .wav header is written to a buffer array. Their sounds are then read and encoded as bitstreams using Androids AudioRecorder, and then are written to the buffer. When the user stops recording, the buffer is written as a .wav file.
In terms of preprocessing, we used a low-pass filter to help eliminate background noise. A low-pass filter filters out high frequencies from low frequencies using a Order 8 Chebyshev Filter the formulas below.
For classification, unlike previous researchers who utilized models such as Hidden Markov Chains, logistic regression, and Bayesian networks, we use a deep neural network that combines components from convolutional neural networks (CNN) and recurrent neural networks (RNN) to be able to analyze and learn spatial and temporal features of sound waves as listed before. CNNs: Apply data transformations called convolutions to take into account noise (Gron 353). Performs well with spatial data Learns the amplitude, shape, and quality features of the heart sounds. RNNs: Use loops in each layer to allow the network to make higher-quality predictions about sequential data (Gron 379). Performs well with temporal data and thus will learn the timing and duration features of the sound files. Our neural network architecture combines ANNs, CNNs, and RNNs to combine the advantages of each type of network. We used 7 1D convolutional layers followed by 5 recurrent layers with a fully connected layer for the decision. The loss function is used to represent the cost of misclassification of our model. By minimizing the the loss function, we boost the accuracy: where p(x) is the true value (0 for normal; 1 for murmur) while q(x) is our models output value.
In terms of the actual structure of the deep learning model, we utilized 7 Convolutional layers with kernel size of 9, followed by a dropout layer and 5 Gated Recurrent Units (GRUs) and a 1 neuron dense neural network layer using a sigmoid activation function. The dropout value utilized was 0.5, the learning rate was 10-3* 0.8epoch, and the stride for max pooling was 4.
One major potential issue with neural networks is overfitting, when the network memorizes training data and fails to generalize to unseen data. To combat this, before the recurrent layers, we used a dropout layer that sets random portion of the weights equal to zero, so the network has to learn different aspects of the data each time. Within each convolutional layer, we also used L2 regularization, which penalizes the network for learning overly complex weights. The full structure of our deep learning model is shown below.
In terms of training, we compiled 600 sound files of murmurs and 600 sound files of normal heartbeats from two databases: Physionet Classification of Normal/Abnormal Heart Sound Recordings Challenge 2016 and the Peter J. Bentley Classifying Heart Sounds Challenge. We split the data randomly into 300 sound files for our validation dataset and 900 sound files for our training dataset. All sound files were listened to manually to ensure sounds were heart sounds and the heart sounds were audible. To deal with inconsistencies in audio time, we implemented the system shown below.
We trained our network on training dataset for 20 epochs and saved the model with the best performance on the validation dataset, evaluating this performance using both the F-beta score of the model and the confusion matrix of the models predictions on the validation dataset.

III. RESULTS
Throughout both training and validation processes, the accuracy and loss values were continuously recorded. In addition, the researchers built a confusion matrix containing true positive, false positive, true negative, and false negative values. Graphs of the accuracy and loss as well as a confusion matrix are detailed below. After training, the model was tested on a validation data set, and its classification performance was measured using the F-beta score, calculated as follows [4]: where precision and sensitivity are weighted averages of the precision and sensitivity of each class [4]: where TP is the number of true positives, FP is the number of false positives, and FN is the number of false negatives. Our algorithm achieved a precision of 0.8768, sensitivity of 0.9030, F-Beta value of 0.8897, and an accuracy of 90.0 percent, as shown by the table below.
To robustly determine the medical potential of our platform as a murmur screening tool, we partnered with Johns Hopkins School of Medicine, who ran our algorithm on 7 sample heart sounds recorded using ECHOs electronic stethoscope, achieving an accuracy of 100 percent. Future tests are planned [11]. The diagram below shows the 7 sample heart sounds and the algorithms output.

IV. DISCUSSION
Our models accuracy exceeds that of the best physicians 83 percent [1]. Our platform is also far more accessible than ECHO. The cost of the stethoscope and application is about 20 dollars, less than one-fiftieth of a fraction of the cost of ECHO [3]. Moreover, our model is not limited by the presence of skilled operators and proper facilities.
Compared to other professional computational techniques that were tested on the Physionet database, our deep learning approach exceeds that of the best: Our balanced sensitivity and precision will result in a small and about equal number of TN and FP, and the high accuracy making it ideal for a reliable screening tool.
However, limitations exist. Our algorithm fails to perform well with recordings with significant amounts of background noise as it was trained on clear recordings. We reduced the effect of background noise using a low-pass filter, but the filter could not remove all background noise. Thus, our platform should be used in a low-noise area for the best results.
Another issue is because we want to increase the accessibility of murmur screening, we have no standard for the stethoscope. The goal was to allow users to build their own and easily integrate it with the mobile platform. But, different stethoscopes have different quality: an electronic stethoscope directly produces the .wav file based on the user's heart vibrations, whereas a cheap stethoscope may not pick up more subtle sounds.

V. CONCLUSION
We have many things planned. First, in terms of structural improvements, we plan to have the doctors portal linked with database. Next, we hope to include database statistics, such as mapping murmur occurrences. Third, we are working on developing a standardized stethoscope blueprint that can be easily constructed to allow this tool to be mass produced and further benefit all of mankind.
To verify that our platform is ready for release, we partnered with the Johns Hopkins School of Medicine to extensively evaluate our platform. Specifically, this partnership entailed testing our algorithm on more than 3000 audio files as well as discussing further improvement to our platform We were recommended to discuss this research with a professor from Johns Hopkins Electrical and Computer Engineering, who previously worked at Bell Laboratories, particularly on the stethoscope hardware and other aspects of signal processing. Finally, as of now, we are limited to binary classification. Once we get more data that is separated into different types of murmurs, we can match the ability of ECHO to determine what type of murmur it is exactly. We have already contacted NIH for more samples and are planning to do the same with INOVA and Virginia Heart.
Overall, we successfully developed a heart murmur detection platform using deep learning. It is more accessible than traditional methods such as echocardiography and more accurate than clinical examinations. Even those who lack access to proper medical facilities or equipment, which require thousands of dollars and medical professionals, can use our system to diagnose themselves. Moreover, our systems murmur detection accuracy, 95.5 percent, exceeds clinical examination standards by over 10 percent. The inexpensive, accessible, and accurate HeartFit platform is an example of how a novel and translational engineering project could benefit humanity.