Cardiovascular diseases are a major global health concern, and machine learning offers opportunities to explore patterns in clinical data that may support healthcare-related research. I wanted to understand how a machine learning model could use patient-related clinical parameters to classify heart disease status and how such a model could be transformed into an accessible, real-world software application.

This motivated me to develop CardioPredict, an end-to-end machine learning web application that combines supervised learning with a cloud-deployed interface.

How I Built It The project was developed using the UCI Heart Disease dataset, containing 920 records and 16 columns. The target variable was converted into a binary classification label, distinguishing between records with and without heart disease.

I implemented a preprocessing pipeline using:

Median imputation for numerical features.

Most-frequent-value imputation for categorical features.

StandardScaler for numerical feature scaling.

One-hot encoding for categorical variables.

I trained and compared three supervised machine learning algorithms:

Logistic Regression Random Forest Classifier Gradient Boosting Classifier

The models were evaluated using stratified five-fold cross-validation. Logistic Regression achieved the highest mean cross-validation accuracy of approximately 82.6% and was selected for the final implementation.

The complete preprocessing and prediction pipeline was serialized using Joblib.

For the application architecture, I developed:

Frontend: React and Vite for an interactive user interface. Backend: Python and FastAPI for model inference through REST APIs. Validation: Pydantic for validating incoming user inputs. Machine Learning: Scikit-learn for preprocessing, training and prediction. Deployment: Netlify for the frontend and Render for the backend.

The deployed application allows users to enter clinical parameters and receive a model-generated classification result along with a probability estimate.

Challenges Faced One of the main challenges was preparing a dataset containing both numerical and categorical attributes, along with missing and potentially invalid values. In particular, certain zero values in cholesterol and resting blood pressure required treatment as missing observations rather than valid measurements.

Another challenge was maintaining consistency between the preprocessing steps used during model training and those applied during real-time prediction. I addressed this by combining preprocessing and classification into a single serialized machine learning pipeline.

Integrating the trained model with a separate FastAPI backend and React frontend also required careful handling of API requests, input validation, CORS configuration and cloud deployment.

What I Learned Through this project, I gained practical experience in the complete machine learning development lifecycle, including dataset exploration, preprocessing, feature engineering, model comparison, cross-validation, model serialization, REST API development and cloud deployment.

I also learned that building a useful ML application involves much more than achieving a good accuracy score. Reliable input handling, consistent preprocessing, accessible deployment, transparent evaluation and clear communication of model limitations are equally important.

Future Scope Future improvements could include out-of-distribution detection, probability calibration, explainable AI techniques such as SHAP, broader external validation, and improved uncertainty estimation. These additions could help make the system more transparent and robust.

CardioPredict is an educational and research-oriented machine learning demonstration. It is not a clinically validated medical diagnostic system and should not be used as a substitute for professional medical evaluation.

Built With

Share this project:

Updates

Submission history