Skip to content

Latest commit

Β 

History

21 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🩺 Breast Cancer Prediction using Machine Learning

An Intelligent Web Application for Early Breast Cancer Detection using Machine Learning

Python Flask Scikit-Learn HTML CSS Bootstrap License


πŸ“Œ Overview

Breast cancer is one of the leading causes of cancer-related deaths among women worldwide. Early diagnosis plays a crucial role in improving survival rates and treatment outcomes.

This project presents a Machine Learning-powered Breast Cancer Prediction System that predicts whether a breast tumor is Benign (Non-Cancerous) or Malignant (Cancerous) based on medical measurements.

The application provides a clean, responsive web interface where users can enter diagnostic values and receive an instant prediction generated by a trained Machine Learning model.


✨ Features

  • 🩺 Predicts Breast Cancer using Machine Learning
  • ⚑ Instant Prediction
  • 🌐 Responsive Flask Web Application
  • 🎯 High Prediction Accuracy
  • πŸ“Š Uses 30 Medical Diagnostic Features
  • πŸ’» User-Friendly Interface
  • πŸ“ˆ Fast and Reliable Prediction
  • πŸ” Clean Input Validation
  • πŸš€ Easy to Deploy
  • πŸ“± Mobile Friendly

πŸ“· Screenshots

🏠 Home Page


πŸ“ Input Form


πŸ“Š Prediction Result


🧠 Machine Learning Algorithms

The following Machine Learning algorithms were evaluated during model development:

  • Logistic Regression
  • Support Vector Machine (SVM)
  • Decision Tree
  • K-Nearest Neighbors (KNN)
  • Random Forest
  • Gradient Boosting

After comparing their performance, Logistic Regression achieved the best overall results and was selected for deployment.


πŸ“‚ Dataset

Dataset Name

Breast Cancer Wisconsin Diagnostic Dataset

The dataset consists of 30 numerical features computed from digitized images of breast fine needle aspirates (FNA).

The target variable contains:

  • Benign (B)
  • Malignant (M)

πŸ“‹ Input Features

The application accepts the following medical parameters:

  • Radius Mean
  • Texture Mean
  • Perimeter Mean
  • Area Mean
  • Smoothness Mean
  • Compactness Mean
  • Concavity Mean
  • Concave Points Mean
  • Symmetry Mean
  • Fractal Dimension Mean
  • Radius SE
  • Texture SE
  • Perimeter SE
  • Area SE
  • Smoothness SE
  • Compactness SE
  • Concavity SE
  • Concave Points SE
  • Symmetry SE
  • Fractal Dimension SE
  • Radius Worst
  • Texture Worst
  • Perimeter Worst
  • Area Worst
  • Smoothness Worst
  • Compactness Worst
  • Concavity Worst
  • Concave Points Worst
  • Symmetry Worst
  • Fractal Dimension Worst

βš™οΈ Project Workflow

                 Breast Cancer Dataset
                          β”‚
                          β–Ό
                 Data Preprocessing
                          β”‚
                          β–Ό
              Data Cleaning & Scaling
                          β”‚
                          β–Ό
            Train-Test Data Splitting
                          β”‚
                          β–Ό
          Machine Learning Model Training
                          β”‚
                          β–Ό
             Model Performance Evaluation
                          β”‚
                          β–Ό
             Best Model Selection
                          β”‚
                          β–Ό
               Save Trained Model (.pkl)
                          β”‚
                          β–Ό
               Flask Web Application
                          β”‚
                          β–Ό
                User Input Features
                          β”‚
                          β–Ό
               Breast Cancer Prediction

πŸ›  Tech Stack

Programming Language

  • Python

Machine Learning

  • Scikit-Learn
  • NumPy
  • Pandas

Visualization

  • Matplotlib
  • Seaborn

Backend

  • Flask

Frontend

  • HTML5
  • CSS3
  • Bootstrap
  • JavaScript

Development Tools

  • Jupyter Notebook
  • VS Code
  • Git
  • GitHub

πŸ“ Project Structure

Breast-Cancer-Prediction/
β”‚
β”œβ”€β”€ static/
β”‚   β”œβ”€β”€ css/
β”‚   β”œβ”€β”€ js/
β”‚   β”œβ”€β”€ images/
β”‚
β”œβ”€β”€ templates/
β”‚   β”œβ”€β”€ index.html
β”‚   β”œβ”€β”€ result.html
β”‚
β”œβ”€β”€ model/
β”‚   β”œβ”€β”€ breast_cancer_model.pkl
β”‚   β”œβ”€β”€ scaler.pkl
β”‚
β”œβ”€β”€ notebook/
β”‚   β”œβ”€β”€ model_training.ipynb
β”‚
β”œβ”€β”€ dataset/
β”‚   β”œβ”€β”€ data.csv
β”‚
β”œβ”€β”€ app.py
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ README.md
└── LICENSE

πŸš€ Installation

Clone Repository

git clone https://github.com/your-username/Breast-Cancer-Prediction.git

Move into the project

cd Breast-Cancer-Prediction

Install dependencies

pip install -r requirements.txt

Run Flask Application

python app.py

Open your browser

http://127.0.0.1:5000

πŸ“Š Model Evaluation Metrics

The trained model was evaluated using multiple classification metrics.

  • Accuracy
  • Precision
  • Recall
  • F1 Score
  • ROC-AUC Score
  • Confusion Matrix

Best Model

πŸ† Logistic Regression


πŸ“ˆ Future Enhancements

  • Deep Learning Model
  • Medical Image Classification
  • Explainable AI (SHAP/LIME)
  • Cloud Deployment
  • REST API
  • Mobile Application
  • Doctor Dashboard
  • Patient History Tracking
  • Authentication System
  • PDF Medical Report Generation

🎯 Objectives

  • Detect breast cancer at an early stage.
  • Assist healthcare professionals.
  • Reduce diagnosis time.
  • Improve prediction accuracy.
  • Demonstrate Machine Learning in Healthcare.
  • Build an interactive prediction system.

πŸ’‘ Key Highlights

βœ… Machine Learning Powered

βœ… Responsive Web Application

βœ… Instant Prediction

βœ… Easy-to-use Interface

βœ… Fast Performance

βœ… Healthcare-based AI Solution

βœ… Deployment Ready


πŸ“š Requirements

Flask
numpy
pandas
scikit-learn
matplotlib
seaborn
joblib

Install all packages

pip install -r requirements.txt

πŸ‘¨β€πŸ’» Author

Rohit Kumar

B.Tech - Computer Science & Engineering

Machine Learning Enthusiast | Python Developer | AI & Data Science

GitHub: https://github.com/rajrohit-49

LinkedIn: https:www.linkedin.com/in/rohitk-cse


πŸ“„ License

This project is licensed under the MIT License.


⭐ Show Your Support

If you found this project helpful,

⭐ Star this repository

🍴 Fork this repository

πŸ›  Contribute to improve it


❀️ Acknowledgement

Special thanks to the open-source community and the creators of the Breast Cancer Wisconsin Diagnostic Dataset, Scikit-Learn, and Flask for making this project possible.


🌟 Final Output

This project demonstrates how Machine Learning can assist in the early prediction of breast cancer, providing quick, reliable, and intelligent predictions through an elegant web application.

"Early Detection Saves Lives."

⭐ If you like this project, don't forget to Star ⭐ the repository.

About

Machine Learning-based Breast Cancer Prediction using Python, Flask, and Scikit-learn.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages