HEART ATTACK PREDICTION BY MACHINE LEARNING(PYTHON) BY ▪ MOHD SABER (17-5038) ▪ MOHD IHTAESHAM UDDIN (17-5045) (DCET-ECE)
Heart Attack Prediction Using Machine Learning Abstract Cardiovascular disease is one of the mostheinous disease, especially the silent heart attack, which attacks a person so abruptly that there’s no time to get it treated and such disease is very difficult to be diagnosed. Various medical data mining and machine learning techniques are being implemented to extract the valuable information regarding the heart disease prediction. Yet, the accuracy of the desired results are not satisfactory. This Model proposes a heart attack prediction system using Machine learning techniques. Health care field has a vast amount of data, for processing those data certain techniques are used. Datamining is one of the techniques often used. Heart disease is the Leading cause of death worldwide. This System predicts the arising possibilities of Heart Disease. The datasets used are classified in terms of medical parameters. This system evaluates those parameters using data mining classification technique. The datasets are processed in python programming using two main Machine Learning Algorithm namely Decision Tree Algorithm and Naive Bayes Algorithm which shows the best algorithm among these two in terms of accuracy level of heart disease. • IDLE we used in this project is JUPYTER NOTEBOOK. • Requirements: Laptop with min 4 GB RAM, Anaconda,Jupyter Notebook, Python 3.7
What is Machine Learning? programming a computer, to optimize performance standards, by using past experience Machine learning is abranch of Artificial Intelligence Calculation of algorithms allow computers to develop behavior's based on real data
Quick facts about Machine Learning Machine learning algorithms Supervised algorithms Apply pastinformation registered,tonewdata Unsupervised algorithms Draw conclusions from datasets Reinforcement algorithms To make a sequence of decisions.
Components of Machine Learning Representation Evaluation Optimization
Case studies on Machine Learning If amember frequently “likes” a friend’sposts, thenews feedwill automatically start showing more ofthat friend’sactivity, earlier inthe feed. Machinelearning algorithms have helped reveal previously unrecognized influences between artists. Netflixpredicts the ratings an individual will give a movie, which they haven’teven watchedyet, based onprevious movie ratings made bythem.
Statistical method used to recommend a movie on Netflix Anybody can ask aquestion Anybodycan answer The bestanswers are votedupand rise to thetop
Industries which will benefit because of Machine Learning and Artificial Intelligence •AI financialadvisors willsoon replace human advisors,ascomputerizedsystems can scan tensof thousands of enterprises to makequickrecommendations. Finance •Sequencing of individual genomes and comparing them to a large database, will allow doctors andAI bots to predict the probability of contracting a particular disease and a remedy to treatit, when it appears. Healthcare
Relationship between ML,AI And Deep Learning
MACHINE LEARNING LIFE CYCLE
GET DATA: Kaggle which is so organized. They give you info on the features, data types, number of records. You can use their kernel too and you won’t have to download the dataset. Reddit which is great for requesting the datasets we want. Google Dataset Search which is still Beta, but it’s amazing. UCI Machine Learning Repository, this one maintains 468 data sets as a service to the machine learning community.
Data CleaningAnd Manupulating Steps in Machine Learning
TRANING AND TESTING THE MODEL 60% 30% 10% VALIDATION
PROPOSED ALGORITHM: Why use DecisionTrees? There are various algorithms in Machinelearning, so choosing the best algorithm for the given dataset and problem is the main point to remember while creating a machine learning model. Below are the two reasons for using the Decision tree: Decision Trees usuallymimic human thinkingabilitywhile making a decision, so it is easy to understand. The logic behind the decision tree can be easily understood because it shows a tree-like structure. EXAMPLE:
KN NEIGHBOUR CLASSIFIER The k-nearest neighbors (KNN) algorithm is a simple, easy-to-implement supervised machine learning algorithm that can be used to solve both classification and regression problems A classificationproblem has a discrete value as its output. For example, “likespineappleon pizza” . A regression problem has a real number (a number with a decimal point) as its output. The KNN Algorithm 1.Load the data 2.InitializeK to your chosen number of neighbors 3. For each example in the data 3.1 Calculatethe distance between the query example and the current example from the data. 3.2 Add the distance and the index of the example to an ordered collection 4. Sort the ordered collection of distances and indices from smallest to largest (in ascending order) by the distances 5. Pick the first K entries from the sorted collection 6. Get the labels of the selected K entries 7. If regression, return the mean of the K labels 8. If classification, return the mode of the K labels
DATA SET:
ABOUT THE DATA SET: Age : Age of the patient Sex : Sex of the patient ca: number of major vessels (0-3) cp : Chest Pain type Value 1: typical angina Value 2: atypicalangina 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) restecg : resting electrocardiographicresults Value 0: normal Value 1: having ST-T wave abnormality(T wave inversions and/orST elevationor depression of > 0.05 mV) Value 2: showing probableor definite left ventricularhypertrophy by Estes' criteria thalach: maximum heart rate achieved target : 0= less chance of heart attack 1= more chance of heart attack
VISUALIZING DATASET:
THALLIUM STRESS TEST
MAXIMUM HEART RATE ACHIEVED
Heart Attack Prediction using Machine Learning
Heart Attack Prediction using Machine Learning

Heart Attack Prediction using Machine Learning

  • 1.
    HEART ATTACK PREDICTIONBY MACHINE LEARNING(PYTHON) BY ▪ MOHD SABER (17-5038) ▪ MOHD IHTAESHAM UDDIN (17-5045) (DCET-ECE)
  • 2.
    Heart Attack PredictionUsing Machine Learning Abstract Cardiovascular disease is one of the mostheinous disease, especially the silent heart attack, which attacks a person so abruptly that there’s no time to get it treated and such disease is very difficult to be diagnosed. Various medical data mining and machine learning techniques are being implemented to extract the valuable information regarding the heart disease prediction. Yet, the accuracy of the desired results are not satisfactory. This Model proposes a heart attack prediction system using Machine learning techniques. Health care field has a vast amount of data, for processing those data certain techniques are used. Datamining is one of the techniques often used. Heart disease is the Leading cause of death worldwide. This System predicts the arising possibilities of Heart Disease. The datasets used are classified in terms of medical parameters. This system evaluates those parameters using data mining classification technique. The datasets are processed in python programming using two main Machine Learning Algorithm namely Decision Tree Algorithm and Naive Bayes Algorithm which shows the best algorithm among these two in terms of accuracy level of heart disease. • IDLE we used in this project is JUPYTER NOTEBOOK. • Requirements: Laptop with min 4 GB RAM, Anaconda,Jupyter Notebook, Python 3.7
  • 3.
    What is MachineLearning? programming a computer, to optimize performance standards, by using past experience Machine learning is abranch of Artificial Intelligence Calculation of algorithms allow computers to develop behavior's based on real data
  • 4.
    Quick facts aboutMachine Learning Machine learning algorithms Supervised algorithms Apply pastinformation registered,tonewdata Unsupervised algorithms Draw conclusions from datasets Reinforcement algorithms To make a sequence of decisions.
  • 5.
    Components of MachineLearning Representation Evaluation Optimization
  • 6.
    Case studies onMachine Learning If amember frequently “likes” a friend’sposts, thenews feedwill automatically start showing more ofthat friend’sactivity, earlier inthe feed. Machinelearning algorithms have helped reveal previously unrecognized influences between artists. Netflixpredicts the ratings an individual will give a movie, which they haven’teven watchedyet, based onprevious movie ratings made bythem.
  • 7.
    Statistical method usedto recommend a movie on Netflix Anybody can ask aquestion Anybodycan answer The bestanswers are votedupand rise to thetop
  • 8.
    Industries which willbenefit because of Machine Learning and Artificial Intelligence •AI financialadvisors willsoon replace human advisors,ascomputerizedsystems can scan tensof thousands of enterprises to makequickrecommendations. Finance •Sequencing of individual genomes and comparing them to a large database, will allow doctors andAI bots to predict the probability of contracting a particular disease and a remedy to treatit, when it appears. Healthcare
  • 9.
  • 10.
  • 11.
    GET DATA: Kaggle whichis so organized. They give you info on the features, data types, number of records. You can use their kernel too and you won’t have to download the dataset. Reddit which is great for requesting the datasets we want. Google Dataset Search which is still Beta, but it’s amazing. UCI Machine Learning Repository, this one maintains 468 data sets as a service to the machine learning community.
  • 12.
    Data CleaningAnd ManupulatingSteps in Machine Learning
  • 13.
    TRANING AND TESTINGTHE MODEL 60% 30% 10% VALIDATION
  • 14.
    PROPOSED ALGORITHM: Why useDecisionTrees? There are various algorithms in Machinelearning, so choosing the best algorithm for the given dataset and problem is the main point to remember while creating a machine learning model. Below are the two reasons for using the Decision tree: Decision Trees usuallymimic human thinkingabilitywhile making a decision, so it is easy to understand. The logic behind the decision tree can be easily understood because it shows a tree-like structure. EXAMPLE:
  • 15.
    KN NEIGHBOUR CLASSIFIER Thek-nearest neighbors (KNN) algorithm is a simple, easy-to-implement supervised machine learning algorithm that can be used to solve both classification and regression problems A classificationproblem has a discrete value as its output. For example, “likespineappleon pizza” . A regression problem has a real number (a number with a decimal point) as its output. The KNN Algorithm 1.Load the data 2.InitializeK to your chosen number of neighbors 3. For each example in the data 3.1 Calculatethe distance between the query example and the current example from the data. 3.2 Add the distance and the index of the example to an ordered collection 4. Sort the ordered collection of distances and indices from smallest to largest (in ascending order) by the distances 5. Pick the first K entries from the sorted collection 6. Get the labels of the selected K entries 7. If regression, return the mean of the K labels 8. If classification, return the mode of the K labels
  • 17.
  • 18.
    ABOUT THE DATASET: Age : Age of the patient Sex : Sex of the patient ca: number of major vessels (0-3) cp : Chest Pain type Value 1: typical angina Value 2: atypicalangina 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) restecg : resting electrocardiographicresults Value 0: normal Value 1: having ST-T wave abnormality(T wave inversions and/orST elevationor depression of > 0.05 mV) Value 2: showing probableor definite left ventricularhypertrophy by Estes' criteria thalach: maximum heart rate achieved target : 0= less chance of heart attack 1= more chance of heart attack
  • 19.
  • 21.
  • 22.