Heart Attack Analysis and prediction using IBM AutoAI

Gather useful insights, predict the outcome with a few simple steps.

Warning sign of heart attack

Heart disease is the leading cause of death in the United States, according to the Centers for Disease Control and Prevention (CDC)Trusted Source. In the United States, 1 in every 4 deaths in is the result of a heart disease. That’s about 610,000 people who die from the condition each year.

Heart disease doesn’t discriminate. Its the leading cause of death for several populations, including white people, Hispanics, and Black people. Almost half of Americans are at risk for heart disease, and the numbers are rising. Learn more about the increase in heart disease rates.

While heart disease can be deadly, it’s also preventable in most people. By adopting healthy lifestyle habits early, you can potentially live longer with a healthier heart.

Problem description

The goal is to predict the binary class target, which represents whether or not a patient has heart disease:

  • 0 represents no heart disease present
  • 1 represents heart disease present


  • Age: Age of the patient
  • Sex: Sex of the patient
  • exang: exercise-induced angina (1 = yes; 0 = no)
  • caa: number of major vessels (0–3)
  • cp : Chest Pain type chest pain type

Value 1: typical angina

Value 2: atypical angina

Value 3: non-anginal pain

Value 4: asymptomatic

  • trtbps : resting blood pressure (in mm Hg)
  • chol : cholestoral in mg/dl fetched via BMI sensor
  • fbs : (fasting blood sugar > 120 mg/dl) (1 = true; 0 = false)
  • rest_ecg : resting electrocardiographic results

Value 0: normal

Value 1: having ST-T wave abnormality (T wave inversions and/or ST elevation or depression of > 0.05 mV)

Value 2: showing probable or definite left ventricular hypertrophy by Estes’ criteria

  • thalach : maximum heart rate achieved
  • slp : the slope of the peak exercise ST segment (1 = upsloping; 2 = flat; 3 = downsloping)
  • thall : 3 = normal; 6 = fixed defect; 7 = reversable defect
  • target : 0= less chance of heart attack 1= more chance of heart attack

IBM Watson Studio AutoAI

Strategic investments in AI can be a game changer. To fulfill the promise of AI, organizations are tackling skill-set gaps, deployment and governance processes today. In particular, businesses are seeking an alternative where citizen data scientists can quickly get started and expert data scientists can speed experimentation time from weeks and months to minutes and hours. They need a multimodal data science and AI environment where data and analytics specialists collaborate with other experts and optimize model performance end-to-end.

To help simplify an AI lifecycle management, AutoAI automates:

  • Data preparation
  • Model development
  • Feature engineering
  • Hyper-parameter optimization

AutoAI is available within IBM Watson® Studio with one-click deployment through Watson Machine Learning. Use it with Watson OpenScale to track and measure AI outcomes together with the Watson Studio family.

Step 1:- Setup

Create an IBM Cloud account. — Create a Watson Studio Instance.

Step 2:- Data source

Upload CSV file or dataset by clicking on create new add data source then Auto AI will analyze the file and prompt you to choose prediction column from following columns.

Step 3:- Experiment Setting

In Experiment Setting , we have three subsetting to configure according to our need.

  • we could select column from all the columns which will acts as feature in machine learning algorithm.
  • Training and test split configuration.
  • Drop Duplicate rows
  • Subsample Rows ( to be used for large dataset)
  • Prediction type(binary,multiclass,regression,time series forecasting)
  • Positive class ( for confusion matrix , log loss)
  • optimized metric ( Here we are choosing ROC AUC — to make sure model learn to distinguish both groups better)
  • Algorithm to choose from multiple algorithm available
  • Algorithm to use from top algorithm in first round of testing.

Step 4:- Run Experiment

Final — Comparision

Model Deployment

Model Notebook

Web Service Deployment


I created one responsive webpage on Angular technology which consumes IBM web service and return the result which I show on my website.

My experiences

AutoAI really makes machine learning simpler, one fear is the lack of control over the parameters and the need to fine-tune certain things. This can easily be done by saving the model as a Notebook and coding in python. In my opinion, Watson AutoAI is the best tool for a beginner to begin their journey as data scientist.

Senior data scientist who loves to code and experiment with data to explore new boundaries where we could benefit humanity.