Creating machine learning model analysis using logistic regression and run the streamlit apps to predict the probability of having heart attack in future.
- Model training - Machine learning
- Method: Logistic Regression
- Deployment apps: Streamlit
In this analysis, dataset used from https://www.kaggle.com/datasets/rashikrahmanpritom/heart-attack-analysis-prediction-dataset.
age: Age of the patient
sex: Sex of the patient
cp: Chest pain type, 0 = Typical Angina, 1 = Atypical Angina, 2 = Non-anginal Pain, 3 = 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 electrocardiographic results, 0 = Normal, 1 = ST-T wave normality, 2 = Left ventricular hypertrophy
thalachh: Maximum heart rate achieved
oldpeak: Previous peak
slp: Slope
caa: Number of major vessels
thall: Thalium Stress Test result ~ (0,3)
exng: Exercise induced angina ~ 1 = Yes, 0 = No
output: Target variable 0:"LOW", 1:"HIGH"
By using logistic regression method, we get the percentace of accuracy 87%You may clone the repository and open the Streamlit apps to test the prediction.
Steps to run the Streamlit apps:
- Open command prompt
- Activate environment Example: conda activate tf_env
- Change directory to your folder path Example: cd C:\Users\snaff\OneDrive\Desktop\project 1\HeartAttack_Analysis
- Run streamlit of your folder Example: streamlit run HeartAttack_Prediction_Deployment.py
- Streamlit apps will appear automatically on your browser
You may insert the patient information details to check the prediction and click "submit" button for the result.
Enjoy!