Heart disease is one of the leading causes of death globally, and early prediction can significantly reduce fatal outcomes. This project presents a machine learning-based approach to predict the likelihood of a heart attack based on various health indicators such as age, gender, cholesterol level, blood pressure, and chest pain type. The model was trained and evaluated using real-world datasets and achieved promising results in classification accuracy.
Cardiovascular diseases have become a major public health concern. Traditional diagnosis often requires invasive procedures, whereas machine learning techniques can provide fast, reliable, and cost-effective predictions. The goal of this research is to develop a predictive model that helps in identifying high-risk individuals using clinical data.
Data Collection:
The dataset was obtained from the UCI Machine Learning Repository (Heart Disease Dataset).
Data Preprocessing:
Model Selection:
Multiple algorithms were tested, including:
Model Training and Validation:
Different models were trained and compared using Python (Scikit-learn). Hyperparameter tuning was performed using GridSearchCV to find optimal model settings.
Below is a sample code snippet:
from sklearn.ensemble import RandomForestClassifier model = RandomForestClassifier(n_estimators=100, random_state=42) model.fit(X_train, y_train) y_pred = model.predict(X_test) <!-- RT_DIVIDER --> # Results The Random Forest model provided the best results with: Accuracy: 89% Precision: 88% Recall: 90% F1-Score: 89% <!-- RT_DIVIDER --> # Conclusion This study demonstrates the potential of machine learning in predicting heart attack risk using basic clinical parameters. Future work can include integration with healthcare applications for real-time prediction and expanding the dataset for better generalization.