{"id":25881077,"url":"https://github.com/pjaiswalusf/heart-failure-prediction","last_synced_at":"2026-03-07T00:03:08.763Z","repository":{"id":278772777,"uuid":"934362877","full_name":"pjaiswalusf/Heart-Failure-Prediction","owner":"pjaiswalusf","description":"A machine learning project predicting heart failure risk using Random Forest and XGBoost. It involves data cleaning, feature engineering, and EDA before training. The best model is saved using Joblib. Key techniques: outlier detection, feature scaling, and optimization.","archived":false,"fork":false,"pushed_at":"2025-02-21T15:37:41.000Z","size":1803,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-02T14:36:51.331Z","etag":null,"topics":["data-processing","data-visualization","feature-engineering","machine-learning","model-training","optimization","random-forest-classifier","saving-model","xgboost"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pjaiswalusf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-17T17:48:13.000Z","updated_at":"2025-02-21T15:41:41.000Z","dependencies_parsed_at":"2025-02-21T16:43:01.248Z","dependency_job_id":null,"html_url":"https://github.com/pjaiswalusf/Heart-Failure-Prediction","commit_stats":null,"previous_names":["pjaiswalusf/heart-failure-prediction"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pjaiswalusf/Heart-Failure-Prediction","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjaiswalusf%2FHeart-Failure-Prediction","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjaiswalusf%2FHeart-Failure-Prediction/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjaiswalusf%2FHeart-Failure-Prediction/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjaiswalusf%2FHeart-Failure-Prediction/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pjaiswalusf","download_url":"https://codeload.github.com/pjaiswalusf/Heart-Failure-Prediction/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjaiswalusf%2FHeart-Failure-Prediction/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30204111,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T19:07:06.838Z","status":"ssl_error","status_checked_at":"2026-03-06T18:57:34.882Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-processing","data-visualization","feature-engineering","machine-learning","model-training","optimization","random-forest-classifier","saving-model","xgboost"],"created_at":"2025-03-02T14:30:37.110Z","updated_at":"2026-03-07T00:03:08.742Z","avatar_url":"https://github.com/pjaiswalusf.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ❤️ Heart Failure Prediction using Machine Learning\n\n## 📌 Project Overview\nThis project focuses on predicting the risk of heart failure using machine learning models. It employs Random Forest and XGBoost classifiers, along with extensive data preprocessing, exploratory data analysis (EDA), and feature engineering to improve predictive accuracy. The best model is saved for future deployment.\n\n---\n\n## 🛠️ Technologies Used\n- **Programming \u0026 Libraries**: Python, NumPy, Pandas, Matplotlib, Seaborn, Plotly\n- **Machine Learning Models**: Random Forest, XGBoost\n- **Data Preprocessing**: MinMaxScaler, Label Encoding, Handling Missing Data, Outlier Detection\n- **Evaluation Metrics**: Confusion Matrix, Classification Report, Cross-Validation\n- **Model Deployment**: Joblib for model serialization\n\n---\n\n## 📊 Dataset Overview\nThe dataset consists of 918 samples with 12 features related to heart health, including:\n- **Age, Sex, Chest Pain Type**\n- **Resting Blood Pressure, Cholesterol Levels**\n- **Fasting Blood Sugar, Resting ECG Results**\n- **Max Heart Rate, Exercise-Induced Angina**\n- **ST Depression (Oldpeak), ST Slope**\n- **Target Variable: Heart Disease (0 = No, 1 = Yes)**\n\n---\n\n## 🔍 Exploratory Data Analysis (EDA)\nEDA was performed to understand data distribution and relationships. Key insights include:\n- Most patients fall within the **50-60 age group**.\n- **Asymptomatic chest pain** is the most common type.\n- **Higher cholesterol and blood pressure levels** correlate with heart disease.\n- **Oldpeak (ST Depression)** is a strong indicator of heart disease.\n\n---\n\n## 🏗️ Data Preprocessing\n1. **Handling Missing Values**: Imputed missing values using median strategy.\n2. **Outlier Detection \u0026 Removal**: Applied IQR method to remove extreme values.\n3. **Feature Encoding**: Converted categorical features into numerical using Label Encoding.\n4. **Feature Scaling**: Used MinMaxScaler to normalize numerical features.\n\n---\n\n## 🤖 Model Training \u0026 Evaluation\nThe dataset was split into **75% training and 25% testing** for model evaluation.\n\n### **Random Forest Classifier**\n- **Training Accuracy**: 100%\n- **Testing Accuracy**: 89.80%\n- **Cross-Validation Score**: 86.62%\n\n### **XGBoost Classifier**\n- **Training Accuracy**: 94.01%\n- **Testing Accuracy**: 89.80%\n- **Cross-Validation Score**: 86.74%\n\nBoth models performed well, with **Random Forest slightly outperforming XGBoost** in accuracy.\n\n---\n\n## 🎯 Key Findings\n- **High cholesterol \u0026 blood pressure significantly contribute to heart disease.**\n- **Exercise-induced angina \u0026 ST depression are strong predictors of heart risk.**\n- **Random Forest performed best in predictive accuracy.**\n\n---\n\n## 🚀 Deployment\nThe trained **Random Forest model** is saved using Joblib for future deployment:\n```python\nimport joblib\njoblib.dump(model, 'RandomForestClassifier_model.sav')\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpjaiswalusf%2Fheart-failure-prediction","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpjaiswalusf%2Fheart-failure-prediction","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpjaiswalusf%2Fheart-failure-prediction/lists"}