Hearbeat Acoustic Analysis

This analysis is performed over heart beat sound wave files, available for public in Kaggle: Source. The dataset consists of two sources: (A) from general public via iStethoscope Pro iPhone and (B) from clinic trial in hospitals, using digital stethoscope DigiScope.

This problem consists of a classification problem, over time-series data, for detection of healthy hearts and abnormal ones.
The study case presented here works on feature engineering over time-series data, as well as spectral engineering and ROC curve.

Database (A) contains 176 audio files and database (B) contains 656 audio files. These records are labeled in four classes:

Some of the data does not have a label, indicating NaN.

Individual analysis

We will start with individual analysis, over one waveform from each class, from database A, to illustrate the feature engineering process, before moving on to the classification model.

As noted before, the Extrahls and Murmur indicate two types of abnormalities in heart beats. Artifact files have too much background noise or inaudible heart beats.

Envelope features

Since we are dealing with sound waves, which is a particular kind of time series data, we may work on envelope. It consists of smoothing and averaging over rolling window.

Tempo features

Tempo is another feature we can extract from waveform data and relates to number of beats per minute.

Spectral features

Finally the most important one, spectral analysis over waveforms.
By applying STFT (short-time Fourier transform) over the waveform, we can extract the spectogram, with frequency content over the time.

Classification model

Feature extraction of training set

For our classification model, we will develop a simple binary classifier. We will use files of normal and murmur labels only. We will apply database (B) as training set and database (A) as test set, to evaluate our classifier. As classification features, we will apply all those presented previously, over the envelope, tempo and frequency domains.

Feature extraction of test set

It can be seen that the training set contains 412 samples and our test set contains 65 samples. Moreover, on our test set, we have 34 labels murmur and 31 labels normal, so our data is evenly distributed.

Classifier ROC (Receiver Operating Characteristic Curve)

For our problem we have a total of 14 features extracted from the waveform files. We will apply a Logistic Regression, since this is a binary classification problem and analyze the model with a dummy classifier, by applying the ROC curve.

As we can see, our model has an accuracy of 0.797. It also has a recall of 0.788, which in this case is more important than accuracy, since we need to detect abnormalities, in case of their real occurrence.

This was just a small simple study case of time series waveforms and we could still improve more the feature engineering and model performance, by removing noise, normalizing data and extracting its variation, instead of using the absolute value.