Skip to content

sdronava/mlzc_midterm

Repository files navigation

Heart Disease Prediction

(ML Zoomcamp 2025 - Midterm Project)

🫀 Problem Description

📊 Dataset Source

The dataset is publicly available on Kaggle: Heart Failure Prediction Dataset
A local copy (heart.csv) is included in this repository for convenience.


🗂 Dataset Overview

  • Number of records: 918 patients
  • Features: 11 medical attributes per patient, including:
    • Age, Sex, Cholesterol, Resting Blood Pressure, Max Heart Rate, etc.
  • Target variable: HeartDisease
    • Binary classification:
      • 1 → Patient has heart disease
      • 0 → Patient does not have heart disease

ℹ️ The dataset is relatively small but contains rich information for predictive modeling. Detailed descriptions of the attributes are available on the Kaggle dataset page.


🎯 Problem Statement

The objective of this project is to build a predictive model that can determine whether a patient is at risk of heart disease based on their medical attributes.

  • Type of problem: Binary classification
  • Goal: Predict the likelihood of heart disease for a given patient record.

By training on this dataset, the model should be able to learn patterns and relationships in the medical features that indicate risk, enabling early detection and potential preventive measures.


⚠️ Notes

  • The dataset used for training (heart.csv) is included in the repository.
  • More details about the features and dataset statistics can be found on the Kaggle dataset page.

Instructions

(Running and Testing the Project)

This application is packaged as a Docker image and can be run locally using Docker. Follow the steps below to start the app and test predictions using the built-in /docs UI.

✅ Prerequisites

You must have the following installed:

Docker → https://www.docker.com/get-started

A modern web browser (Chrome, Safari, Firefox, etc.)

No other tools or setup are required.

🚀 Run the App Locally Using Docker

Pull and run the Docker image:

docker run -p 9696:9696 dvsrinath/mlzc-midterm-srinath

This starts the FastAPI app with the following entrypoint:

uvicorn predict:app --host 0.0.0.0 --port 9696

Once running, the service will be available at:

http://localhost:9696

📘 Test the API Using Swagger UI

Open your browser and go to:

http://localhost:9696/docs

This will load the interactive FastAPI Swagger documentation.

Example Request Body

Use the following sample data for testing:

{ "age": 58, "sex": "m", "chestpaintype": "asy", "restingbp": 114, "cholesterol": 318, "fastingbs": "low", "restingecg": "st", "maxhr": 140, "exerciseangina": "n", "oldpeak": 4.4, "st_slope": "down" }

✅ Expected Response

If everything is working correctly, you should receive a prediction similar to:

{ "heartdisease_probability": 0.8307692307692308, "heartdisease": true }

🛑 Stopping the App

Press Ctrl+C in the terminal that is running the container, or stop the container using:

docker ps docker stop <container_id>


Additional Info

flyway.io

Attached images from a local run of flyway.io:

fly.io swagger

Account: https://fly.io/apps/mlzc-midterm/monitoring App: https://mlzc-midterm.fly.dev/ (Note the app has been torn down and is not available)

Source Code

https://github.com/sdronava/mlzc_midterm

(Reference) Project Requirements Page:

https://github.com/DataTalksClub/machine-learning-zoomcamp/tree/master/projects

About

ML Zoomcamp 2025 - Midterm Project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages