Skip to content

Diabetes Prediction: A simple web application developed using Django framework to predict diabetes based on the Pima Indian Diabetes Dataset. The model, trained using K-nearest neighbor algorithm, achieves an accuracy of approximately 80%.

Notifications You must be signed in to change notification settings

JSM2512/DiabetesPrediction

Repository files navigation

DiabetesPrediction

DiabetesPrediction is a machine learning project aimed at predicting the occurrence of diabetes in patients based on various medical factors. The project uses a variety of models and techniques to provide accurate predictions.

Table of Contents

Overview

This project is designed to predict diabetes using machine learning algorithms. It utilizes the Pima Indians Diabetes Database, which includes several medical predictor variables and one target variable, Outcome. The goal is to build a model that accurately predicts whether a patient has diabetes.

Methodology Chart

Screenshot (420)

Project Structure

DiabetesPrediction/
├── manage.py
├── requirements.txt
├── diabetes_prediction/
│   ├── __init__.py
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
├── prediction/
│   ├── migrations/
│   │   └── ...
│   ├── templates/
│   │   └── ...
│   ├── __init__.py
│   ├── admin.py
│   ├── apps.py
│   ├── models.py
│   ├── tests.py
│   └── views.py
└── static/
    └── ...
  • manage.py: Django's command-line utility for administrative tasks.
  • requirements.txt: File listing the Python dependencies for the project.
  • diabetes_prediction/: Django project directory containing settings and configuration.
    • settings.py: Django settings and configuration file.
    • urls.py: URL routing configuration.
    • wsgi.py: WSGI application entry point.
  • prediction/: Django app directory for the prediction functionality.
    • migrations/: Directory for database migrations.
    • templates/: Directory for HTML templates.
    • admin.py: Django admin configuration.
    • apps.py: Django app configuration.
    • models.py: Django models for the app.
    • tests.py: Unit tests for the app.
    • views.py: Views handling web requests and responses.
  • static/: Directory for static files (e.g., CSS, JavaScript).

Dataset

The dataset used in this project is the Pima Indians Diabetes Database, which can be found on Kaggle. It contains the following attributes:

  1. Pregnancies
  2. Glucose
  3. Blood Pressure
  4. Skin Thickness
  5. Insulin
  6. BMI
  7. Diabetes Pedigree Function
  8. Age
  9. Outcome (target variable)

Technologies

  • Python
  • Django
  • MongoDB
  • Jupyter Notebook
  • SKLearn
  • HTML
  • CSS

Installation

  1. Clone the repository:
    git clone https://github.com/JSM2512/DiabetesPrediction.git
  2. Navigate to the project directory:
    cd DiabetesPrediction
  3. Create and activate a virtual environment:
    python -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`
  4. Install the required dependencies:
    pip install -r requirements.txt

Usage

  1. Apply the database migrations.
    python manage.py migrate
  2. Create a superuser to access the Django admin.
    python manage.py createsuperuser
  3. Run the Django development server.
    python manage.py runserver
  4. Open your web browser and go to http://127.0.0.1:8000/ to access the web interface for diabetes prediction.
  5. Access the Django admin interface at http://127.0.0.1:8000/admin/ to manage the application data.

Models

The following models have been implemented in this project:

  • Random Forest
  • K-Nearest Neighbors (KNN)

Results

The performance of each model is evaluated using various metrics such as accuracy, precision, recall, and F1-score. The results are compared to determine the best-performing model.

About

Diabetes Prediction: A simple web application developed using Django framework to predict diabetes based on the Pima Indian Diabetes Dataset. The model, trained using K-nearest neighbor algorithm, achieves an accuracy of approximately 80%.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published