Inspiration

What it does

Inspiration Heart failure has become a global public health challenge, with hidden onset and high misdiagnosis rates in early stages—many people overlook key health signals until the condition deteriorates. During our pre-hackathon research, we discovered that clinical data (such as blood pressure, cholesterol levels, and lifestyle factors) contains valuable clues for early prediction, yet these data are often underutilized in rapid risk assessment. What truly inspired us was the desire to bridge the gap between raw health data and practical preventive care. We noticed that the provided datasets (cardiac_failure_processed.csv and cardio_base.csv) contained comprehensive features of over 1,900 participants, including physiological indicators, lifestyle habits, and clinical outcomes. This wealth of data gave us the opportunity to build a model that could identify high-risk groups early, potentially helping individuals take proactive measures and reducing the burden on healthcare systems. We believed that leveraging machine learning to unlock insights from this data could turn abstract numbers into actionable health guidance—this became the core motivation driving our project. What it does Our project develops a high-precision heart failure prediction system based on LightGBM, designed to identify individuals at risk of heart failure using routine health and lifestyle data. The system takes 14 key features as input, including age, gender, height, weight, blood pressure (systolic and diastolic), cholesterol levels, glucose levels, smoking status, alcohol consumption, physical activity, BMI, pulse pressure, and a custom "blood pressure danger flag" (indicating whether blood pressure exceeds normal thresholds). By analyzing these features, the model predicts the probability of heart failure, with a adjusted threshold of 0.4 to prioritize reducing false negatives (critical for medical scenarios where missing a potential case could have severe consequences). Additionally, the system generates visualizations (such as feature importance bar charts) to intuitively show which factors most strongly influence heart failure risk, making the model's decisions interpretable and useful for both healthcare providers and the general public. How we built it

  1. Data Preparation & Preprocessing We started with the raw dataset (cardio_base.csv) and performed rigorous cleaning to ensure data quality: Converted age from days to years for better interpretability. Filtered abnormal blood pressure values (retained systolic pressure 40-240 mmHg and diastolic pressure 40-180 mmHg, with systolic > diastolic). Engineered new features: BMI (weight/height²), pulse pressure (systolic - diastolic), and bp_danger (binary flag for hypertension). Selected 14 core features to balance model complexity and predictive power.
  2. Model Selection & Optimization After evaluating traditional models (e.g., logistic regression, random forest), we chose LightGBM for its efficiency with tabular data and ability to handle non-linear relationships: Configured key parameters: 200 estimators, learning rate of 0.05, and num_leaves=31 to avoid overfitting. Adjusted scale_pos_weight=1.2 to address potential class imbalance and prioritize positive case detection. Optimized the classification threshold from 0.5 to 0.4 to improve recall (reducing missed cases).
  3. Evaluation & Visualization Used train-test split (80/20) with random_state=42 to ensure reproducibility. Evaluated performance using AUC score, classification report (precision, recall, F1-score), and confusion matrix. Generated a feature importance visualization to communicate model insights, which was saved as a PPT-ready image. Challenges we ran into
  4. Data Quality & Anomaly Handling The raw dataset contained outliers (e.g., extreme blood pressure values) and inconsistent value ranges. We spent significant time validating clinical 合理性 (e.g., consulting standard blood pressure ranges) to avoid biasing the model—this required balancing data retention and quality.
  5. Class Imbalance & Threshold Tuning Initial model iterations showed low recall for positive cases (heart failure), as the default 0.5 threshold favored precision. We had to experiment with threshold values and scale_pos_weight to find a balance that met medical requirements (prioritizing recall without excessive loss of precision).
  6. Feature Engineering Trade-offs We debated whether to include more derived features (e.g., BMI categories) or keep the model simple. Over-engineering led to overfitting, while too few features reduced predictive power. Through iterative testing, we settled on 14 features that balanced interpretability and performance.
  7. Model Interpretability Machine learning models in healthcare require transparency. Explaining how features like cholesterol or physical activity influence predictions was challenging—we addressed this by focusing on feature importance visualizations and avoiding "black box" model designs. Accomplishments that we're proud of Achieved a stable AUC score (consistently above 0.85) and improved recall for positive cases (up from 0.72 to 0.81 after threshold optimization), making the model clinically relevant. Built an end-to-end pipeline from data cleaning to visualization, with output files (feature_importance.png) ready for presentation. Identified the top 5 most influential factors for heart failure (age, blood pressure, BMI, cholesterol, and pulse pressure), providing clear guidance for preventive care. Created a model that is both high-performance and interpretable—suitable for non-technical stakeholders like healthcare providers and patients. What we learned Technical Skills: Mastered LightGBM parameter tuning, threshold optimization, and feature engineering for tabular medical data. Gained hands-on experience with imbalanced classification in healthcare scenarios. Domain Knowledge: Deepened our understanding of clinical indicators for heart failure—learning how physiological metrics (e.g., pulse pressure) and lifestyle factors interact to influence risk. Team Collaboration: Split tasks (data cleaning, model building, visualization) to leverage individual strengths, and iterated quickly through feedback—critical for hackathon time constraints. Healthcare Context Awareness: Recognized that medical AI models require trade-offs between technical performance and real-world utility (e.g., prioritizing recall to avoid missed diagnoses). Learned to communicate technical results in a clinically meaningful way. ## How we built it

Challenges we ran into

Accomplishments that we're proud of

What we learned

What's next for No.1.Emo

Share this project:

Updates

Submission history