Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Predicting Heart Disease Using Machine Learning

Python Jupyter Notebook scikit-learn


Description

This project uses machine learning to predict the likelihood of heart disease based on clinical, demographic, and diagnostic features. The models are trained on the Heart Failure Prediction Dataset and can help with early detection and risk assessment.


Technologies & Tools

  • Python (Pandas, NumPy)
  • Scikit-learn (Logistic Regression, Random Forest Classifier)
  • Matplotlib & Seaborn (visualizations)
  • Jupyter Notebook

Dataset

  • Sourced from Kaggle: Heart Failure Prediction Dataset
  • 918 observations, 11 features including Age, Sex, Blood Pressure, Cholesterol, Max Heart Rate, etc.
  • Binary classification: HeartDisease (1 = yes, 0 = no)

Methodology

  1. Data preprocessing:

    • Standardized numerical features
    • Encoded categorical and binary features
    • Replaced zero-values in Cholesterol with median values
  2. Modeling:

    • Logistic Regression for linear relationships
    • Random Forest Classifier for capturing non-linear patterns
    • 5-fold cross-validation using recall as the primary metric
  3. Evaluation:

    • Confusion matrices, accuracy, recall, F1-score
    • Feature importance analysis

Results

Model Accuracy Recall (Positive) F1-Score (Positive)
Random Forest Classifier 0.89 0.89 0.90
Logistic Regression 0.88 0.87 0.89
  • Random Forest slightly outperforms Logistic Regression.
  • Models are promising for screening purposes but not for definitive diagnosis.

Visualizations

  • Feature correlation heatmap
  • Confusion matrices for each model
  • Feature importance bar charts from Random Forest

Potential improvements

  • Use larger datasets to improve model performance
  • Explore Gradient Boosting, SVMs, or Neural Networks for better non-linear pattern capture
  • Tune hyperparameters for higher accuracy and recall

How to Run

Open HeartDiseasePrediction.ipynb with Jupyter or Google Colab.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages