๐ฉบ Advanced neural network for breast cancer classification using Wisconsin dataset. Analyzes cell nucleus characteristics from FNA samples to distinguish malignant/benign masses with 96.5% accuracy. Features comprehensive documentation, automated setup, testing framework, and deployment guides. Educational ML project with 15,000+ lines of docs.
๐ง Neural Network Breast Cancer Classification
Advanced machine learning approach for automated breast cancer diagnosis using neural networks
๐ Dataset โข ๐ฌ Features โข ๐ Quick Start โข ๐ Results โข ๐ Documentation โข ๐ข Deployment โข ๐งช Testing
๐ Quick Navigation
- ๐ Get Started: Run
python setup.pyfor automated setup - ๐ Learn: Explore comprehensive documentation (15,000+ lines)
- ๐งช Train Model: Open
models/training.ipynbin Jupyter - ๐ข Deploy: Check deployment guide for production
- ๐ค Contribute: Read contributing guidelines
- โ Help: Check FAQ for common questions
๐ฏ Project Overview
This project implements a sophisticated neural network classifier for breast cancer diagnosis using the Wisconsin Breast Cancer Dataset. The system analyzes cell nucleus characteristics from Fine Needle Aspiration (FNA) samples to distinguish between malignant and benign breast masses with high accuracy.
๐ Key Highlights
- High Accuracy: Achieves 96.5% classification accuracy with comprehensive evaluation
- Clinical Relevance: Based on real medical diagnostic procedures (FNA)
- Deep Learning: Advanced neural network architectures with regularization
- Comprehensive Documentation: 15,000+ lines of detailed documentation
- Production Ready: Complete deployment pipeline from local to cloud
- Educational Focus: Structured for learning with detailed explanations
- Automated Setup: One-command project setup with environment verification
- Testing Framework: Comprehensive testing with 90%+ coverage goals
- Multiple Deployment Options: Jupyter, Web App, API, Docker, Cloud platforms
๐ฌ Medical Context
Breast cancer is the second most common cancer among women worldwide. Early detection through accurate diagnosis is crucial for successful treatment outcomes. This project leverages machine learning to assist medical professionals in making more consistent and accurate diagnoses based on quantitative cell nucleus analysis.
๐ฉบ Fine Needle Aspiration (FNA)
The dataset is based on FNA samples, a minimally invasive procedure that:
- Uses a thin needle to extract cell samples from breast masses
- Provides cell nucleus characteristics for analysis
- Enables computer-aided diagnosis to support medical decisions
๐ Dataset
The Wisconsin Breast Cancer Dataset contains 569 samples with 30 features each, derived from digitized images of FNA samples. Each feature represents a characteristic of cell nuclei present in the image.
Feature Categories
- Radius: Mean of distances from center to points on the perimeter
- Texture: Standard deviation of gray-scale values
- Perimeter: Nucleus perimeter measurements
- Area: Nucleus area measurements
- Smoothness: Local variation in radius lengths
- Compactness: Perimeterยฒ / area - 1.0
- Concavity: Severity of concave portions of the contour
- Concave Points: Number of concave portions of the contour
- Symmetry: Nucleus symmetry measurements
- Fractal Dimension: "Coastline approximation" - 1
- Mean: Average value
- Standard Error: Standard error of the mean
- Worst: Mean of the three largest values
๐ Quick Start
Prerequisites
- Python 3.8 or higher
- pip package manager
- Jupyter Notebook (optional, for interactive analysis)
Installation
- Clone the repository
git clone https://github.com/NhanPhamThanh-IT/Neural-Network-Breast-Cancer-Classification.git
cd Neural-Network-Breast-Cancer-Classification
- Automated Setup (Recommended)
python setup.py
This automated script will:
- โ Check Python version (3.8+ required) - ๐ฆ Install all dependencies from requirements.txt - ๐ Verify package installations - ๐งช Test imports and functionality - ๐ค Check TensorFlow GPU availability - ๐ Set up custom Jupyter kernel - ๐ Create necessary project directories - ๐ Provide next steps guidance
- Manual Setup (Alternative)
# Create virtual environment (recommended)
python -m venv venv
# Windows
venv\Scripts\activate
# macOS/Linux
source venv/bin/activate
# Install dependencies pip install -r requirements.txt
# For development (optional) pip install -r requirements-dev.txt
๐โโ๏ธ Running the Project
Option 1: Automated Setup (Recommended)
python setup.py
This script will automatically:
- Check Python version compatibility
- Install all required dependencies
- Verify package installations
- Set up Jupyter kernel
- Create necessary directories
- Run basic functionality tests
Option 2: Manual Setup
- Install dependencies
pip install -r requirements.txt
- Launch Jupyter Notebook
jupyter notebook
- Open the training notebook
models/training.ipynb
- Run all cells to train and evaluate the model
- Explore the results
๐ง Project Structure
Neural-Network-Breast-Cancer-Classification/
โโโ ๐ docs/ # Comprehensive documentation
โ โโโ ๐ dataset.md # Dataset analysis and medical context (1,237 lines)
โ โโโ ๐ neural-network.md # Neural network theory and implementation (875 lines)
โ โโโ ๐ pandas.md # Data manipulation guide (875 lines)
โ โโโ ๐ tensorflow.md # TensorFlow implementation reference (897 lines)
โโโ ๐ models/ # Model training and data
โ โโโ ๐ training.ipynb # Main training notebook (46 cells)
โ โโโ ๐ breastcancerdataset.csv # Wisconsin Breast Cancer Dataset
โ โโโ ๐ saved_models/ # Trained model files (created during training)
โ โโโ ๐ checkpoints/ # Training checkpoints (created during training)
โโโ ๐ logs/ # Training logs and metrics (auto-created)
โโโ ๐ outputs/ # Generated outputs and results (auto-created)
โโโ ๐ plots/ # Visualization plots (auto-created)
โโโ ๐ requirements.txt # Production dependencies
โโโ ๐ requirements-dev.txt # Development and testing dependencies
โโโ ๐ setup.py # Automated project setup script (250+ lines)
โโโ ๐ README.md # Project overview (this file)
โโโ ๐ CONTRIBUTING.md # Comprehensive contribution guidelines
โโโ ๐ CHANGELOG.md # Version history and release notes
โโโ ๐ API.md # Complete API documentation (800+ lines)
โโโ ๐ TESTING.md # Testing framework and strategies (1,000+ lines)
โโโ ๐ DEPLOYMENT.md # Deployment guide from local to cloud (1,200+ lines)
โโโ ๐ FAQ.md # Frequently asked questions (800+ lines)
โโโ ๐ PROJECT_STRUCTURE.md # Detailed project organization guide
โโโ ๐ PROJECT_SUMMARY.md # Complete project overview and highlights
โโโ ๐ LICENSE # MIT License
๐ Documentation Statistics
- Total Documentation: 15,000+ lines across multiple files
- Comprehensive Guides: 4 detailed technical guides in docs/
- API Reference: Complete API documentation with examples
- Testing Documentation: Full testing framework and best practices
- Deployment Guide: From local development to cloud production
๐ง Neural Network Architecture
The model implements a sophisticated deep learning architecture:
- Input Layer: 30 features (cell nucleus characteristics)
- Hidden Layers: Multiple dense layers with dropout for regularization
- Activation Functions: ReLU for hidden layers, Sigmoid for output
- Optimization: Adam optimizer with adaptive learning rate
- Loss Function: Binary crossentropy for binary classification
Model Features
- Dropout Regularization: Prevents overfitting
- Batch Normalization: Stabilizes training
- Early Stopping: Prevents overtraining
- Learning Rate Scheduling: Adaptive learning rate adjustment
๐ Results
Performance Metrics
| Metric | Score | | ------------- | ----- | | Accuracy | 96.5% | | Precision | 95.8% | | Recall | 97.2% | | F1-Score | 96.5% | | AUC-ROC | 0.987 |
Key Insights
- Most Important Features: Worst perimeter, worst area, worst concave points
- Model Robustness: Consistent performance across different data splits
- Clinical Relevance: Results align with medical understanding of cancer characteristics
๐ฌ Features
๏ฟฝ Automated Setup
- One-Command Setup:
python setup.pyhandles everything - Environment Verification: Python version and dependency checks
- GPU Detection: Automatic TensorFlow GPU configuration detection
- Jupyter Integration: Custom kernel setup for the project
- Directory Creation: Automatic creation of necessary project directories
๏ฟฝ๐ Data Analysis
- Comprehensive exploratory data analysis
- Statistical correlation analysis
- Feature importance ranking
- Data visualization and insights
- Medical context integration
๐ค Machine Learning
- Deep neural network implementation
- Advanced preprocessing pipeline
- Cross-validation and model selection
- Hyperparameter optimization
- Regularization techniques (Dropout, Batch Normalization)
๐ Evaluation
- Multiple performance metrics
- Confusion matrix analysis
- ROC curve and AUC analysis
- Model interpretability features
- Comprehensive testing framework
๐ ๏ธ Engineering
- Modular and maintainable code
- Comprehensive documentation (15,000+ lines)
- Production-ready implementation
- Easy reproducibility
- CI/CD ready with testing framework
๐ Deployment Options
- Local Development: Jupyter notebook interface
- Web Application: Flask-based web interface
- API Deployment: RESTful API with health checks
- Docker: Containerized deployment
- Cloud Platforms: AWS, GCP, Azure deployment guides
- Model Serving: TensorFlow Serving for production
๐ Documentation
Comprehensive documentation is available throughout the project:
๐ Core Documentation (docs/)
- Dataset Guide: Complete dataset analysis and medical context (1,237 lines)
- Neural Network Guide: Architecture and implementation details (875 lines)
- Pandas Guide: Data manipulation and preprocessing techniques (875 lines)
- TensorFlow Guide: Deep learning implementation with TensorFlow (897 lines)
๐ง Development Documentation
- API Reference: Complete API documentation with examples (800+ lines)
- Testing Guide: Comprehensive testing framework and strategies (1,000+ lines)
- Deployment Guide: From local to cloud deployment (1,200+ lines)
- Contributing Guidelines: Complete development guidelines
- FAQ: Frequently asked questions and troubleshooting (800+ lines)
๐ Project Information
- Project Structure: Detailed project organization guide
- Project Summary: Complete project overview and highlights
- Changelog: Version history and release notes
๐ฏ Educational Value
This project serves as a comprehensive learning resource for:
- Machine Learning Students: Complete ML pipeline implementation
- Medical AI Researchers: Healthcare applications and considerations
- Data Scientists: Professional-grade project structure and documentation
- Software Engineers: Production deployment and testing strategies
๐ค Contributing
We welcome contributions! This project includes comprehensive guidelines for contributors.
๐ Quick Contributing Steps
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
๐ Comprehensive Guidelines
Please read our detailed guides:
- Contributing Guidelines: Complete development setup and processes
- Testing Guide: Testing framework and best practices
- API Documentation: API reference for developers
- Project Structure: Understanding the project organization
๐ง Development Setup
# Clone and setup development environment
git clone https://github.com/NhanPhamThanh-IT/Neural-Network-Breast-Cancer-Classification.git
cd Neural-Network-Breast-Cancer-Classification
Run automated setup
python setup.py
Install development dependencies
pip install -r requirements-dev.txt
Run tests
pytest
Format code
black .
flake8 .
๐ก Contribution Areas
- ๐ Bug Reports: Report issues or unexpected behavior
- ๐ก Feature Requests: Suggest improvements or new features
- ๐ Documentation: Improve or expand documentation
- ๐งช Testing: Add or improve tests
- ๐ง Code: Fix bugs or implement new features
- ๐ Data Analysis: Improve data processing or analysis
- ๐ค Model Improvements: Enhance neural network architecture
Development Guidelines
- Follow PEP 8 style guidelines
- Add comprehensive docstrings
- Include unit tests for new features
- Update documentation as needed
- Use conventional commit messages
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- University of Wisconsin: For providing the breast cancer dataset
- Medical Community: For advancing computer-aided diagnosis research
- Open Source Community: For the amazing tools and libraries
- Contributors: Thank you to all who contribute to this educational resource
โ๏ธ Medical Disclaimer
Important: This project is for educational and research purposes only. It should never be used for actual medical diagnosis or treatment decisions. Always consult qualified healthcare professionals for medical advice, diagnosis, or treatment.
๐ Educational Impact
This project serves multiple educational purposes:
- Academic Research: Baseline implementation for medical AI research
- Learning Resource: Complete ML pipeline for students and professionals
- Best Practices: Professional-grade project structure and documentation
- Industry Reference: Production-ready deployment strategies
๐ Project Statistics
- 15,000+ lines of comprehensive documentation
- Production-ready deployment configurations
- Comprehensive testing framework with 90%+ coverage goals
- Multi-platform support (Windows, macOS, Linux)
- Cloud deployment ready (AWS, GCP, Azure)
- Educational focus with detailed explanations throughout
๐ Contact
Nhan Pham Thanh
- GitHub: @NhanPhamThanh-IT
- Project Link: Neural-Network-Breast-Cancer-Classification
โญ Star this repository if you find it helpful!
Made with โค๏ธ for advancing medical AI research