Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.

Language HitCount

Cardiac Arrhythmia Multi Class Classification

The study aims to correctly classify 15 different types of cardiac arrhythmia. The project was done as part of Machine Learning class at the University of Texas at Dallas.

The entire summary of the project can be found in the Jupyter Notebook

Table of contents

General info

This study is conducted to classify patients into one of the sixteen subclasses, among which one class represents the absence of disease and the other fifteen classes represent electrocardiogram records of various subtypes of arrhythmias.


  • Python - version 3.5
  • Tensorflow


The dataset used and its metadata can be found here. The jupyter notebook can be downloaded here and can be used to reproduce the result. Installation of TensorFlow would be required to run all the models. You can find the instructions to install TensorFlow here.


  • As it is a huge dataset with nearly 280 variables first I performed feature selection technique to identify the important variables impacting the prediction.
  • I used various machine learning models like KNN, logistic regression, random forest, decision tree, linear & kernelized SVM and compared the precision and recall of the mentioned models.
  • To improve the accuracy of the models I used bagging and boosting and evaluated the performance of these models.
  • As the data file had 280 variables, I used PCA to improve accuracy.

The entire summary of the project can be found in the Jupyter Notebook

Code Examples

# KNN Regression

from sklearn.neighbors import KNeighborsClassifier
from sklearn.model_selection import GridSearchCV

## We are creating a grid for which all n_neighbors values are to be used for cross validation

param_grid={'weights':['distance', 'uniform'], 'n_neighbors':range(1,100)}

## Using Grid search for exhaustive searching

grid_search = GridSearchCV( KNeighborsClassifier(),param_grid, cv = 10), data_train_y)

# KNN with Bagging

from sklearn.ensemble import BaggingClassifier

KNN_bagging = BaggingClassifier(knn, n_estimators = 100, bootstrap = True),data_train_y)
pred = KNN_bagging.predict(data_test_x)

# Ada boosting with Logistic regression

from sklearn.ensemble import AdaBoostClassifier
param_grid = {'learning_rate':[0.0001,0.001,0.01,0.1,1]}
adaboost_log = GridSearchCV(AdaBoostClassifier(base_estimator = log,random_state = 0), param_grid, cv=5,return_train_score=True), data_train_y)

pred = adaboost_log.predict(data_test_x)
# KNN with PCA

from sklearn.neighbors import KNeighborsClassifier

param_grid = {'weights':['distance', 'uniform'], 'n_neighbors':range(3,100)}

grid_search_knn = GridSearchCV(KNeighborsClassifier(), param_grid, cv=5,return_train_score=True), data_train_y_pca)


  • We were able to improve the classification accuracy and classify the type of cardiac arrhythmia with 75% accuracy.


Project is: finished


Created by me and my teammate Siddharth Oza.

If you loved what you read here and feel like we can collaborate to produce some exciting stuff, or if you just want to shoot a question, please feel free to connect with me on email, LinkedIn, or Twitter. My other projects can be found here.

GitHub Twitter


Multiclass Classification of Cardiac Arrhythmia Using Feature Selection






No releases published


No packages published