A comprehensive machine learning web application for diabetes prediction, featuring real-time model evaluation and interactive performance visualization. This platform combines modern ML techniques with an intuitive interface to help analyze diabetes risk factors and make predictions.
- Multi-kernel architecture (RBF, Linear, Polynomial, Sigmoid)
- Dynamic regularization parameter optimization
- Hyperplane visualization for decision boundary analysis
- Kernel performance comparison analytics
- Adaptive neighbor selection algorithm
- Distance-weighted prediction system
- Automated feature space normalization
- K-value optimization through cross-validation
- L1/L2 regularization support
- Automated learning rate optimization
- Feature importance ranking
- Probability calibration
- Dynamic depth optimization
- Automated pruning mechanisms
- Feature importance visualization
- Tree structure visualization
-
Real-time Performance Metrics
- ROC-AUC curve analysis
- Precision-Recall curve visualization
- Confusion matrix heat mapping
- Cross-validation performance tracking
-
Feature Analysis
- SHAP (SHapley Additive exPlanations) values
- Partial dependence plots
- Feature importance rankings
- Correlation analysis dashboard
-
Data Cleaning
- Automated outlier detection and handling
- Missing value imputation using KNN
- Feature scaling optimization
- Data integrity validation
-
Feature Engineering
- Automated feature selection
- Polynomial feature generation
- Interaction term analysis
- Dimension reduction techniques
graph TD
A[Web Interface] --> B[Flask API Layer]
B --> C[Model Manager]
C --> D[Data Preprocessor]
C --> E[Model Registry]
D --> F[Feature Engineer]
E --> G[Model Evaluator]
G --> H[Performance Analytics]
- Python 3.9+ - Core programming language
- Flask - Web framework with RESTful capabilities
- Scikit-learn - Machine learning framework
- Pandas & NumPy - Data processing and numerical computations
- Redis - Model caching and performance optimization
- SQLAlchemy - Database ORM for model versioning
- HTML5/CSS3 - Modern web standards
- JavaScript (ES6+) - Dynamic functionality
- Bootstrap 5 - Responsive design framework
- Chart.js - Interactive visualizations
- D3.js - Advanced data visualizations
- Docker - Containerization
- Git - Version control
- Black - Code formatting
- Pytest - Testing framework
- GitHub Actions - CI/CD pipeline
# Clone the repository
git clone https://github.com/parisa-roozgarian/diabetes-prediction.git
# Navigate to project directory
cd diabetes-prediction
# Build and run with Docker
docker-compose up --build# Create virtual environment
python -m venv venv
source venv/bin/activate # Unix
.\venv\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
# Run application
python run.pyfrom diabetes_predictor import ModelManager
# Initialize model manager
model_manager = ModelManager()
# Train and evaluate models
results = model_manager.train_evaluate(
model_type='svm',
params={
'kernel': 'rbf',
'C': 1.0
}
)
# Access performance metrics
print(results.metrics)import requests
# Make predictions
response = requests.post(
'http://localhost:5000/api/predict',
json={
'glucose': 155,
'blood_pressure': 70,
'bmi': 25.1,
# Additional features...
}
)
prediction = response.json()| Model | Accuracy | F1 Score | Precision | Recall | ROC-AUC |
|---|---|---|---|---|---|
| SVM (RBF) | 0.89 | 0.88 | 0.87 | 0.89 | 0.91 |
| KNN | 0.85 | 0.84 | 0.86 | 0.83 | 0.88 |
| Logistic Regression | 0.86 | 0.85 | 0.84 | 0.87 | 0.89 |
| Decision Tree | 0.83 | 0.82 | 0.81 | 0.84 | 0.85 |
# Run unit tests
pytest tests/unit
# Run integration tests
pytest tests/integration
# Generate coverage report
pytest --cov=diabetes_predictor tests/Comprehensive API documentation is available at /docs endpoint after running the application. The documentation includes:
- Endpoint specifications
- Request/response schemas
- Authentication requirements
- Rate limiting information
- Example requests
- JWT-based authentication
- Rate limiting
- Input validation
- CORS protection
- Data encryption
- Audit logging
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
See CONTRIBUTING.md for detailed guidelines.
- Basic model implementation
- API development
- Frontend dashboard
This project is licensed under the MIT License - see the LICENSE file for details.
Parisa Roozgarian
- LinkedIn: Parisa Roozgarian
- GitHub: @parisa-roozgarian
- Portfolio: www.parisaroozgarian.com
- Pima Indians Diabetes Database for the dataset
- scikit-learn team for the excellent ML framework
- Flask team for the robust web framework
- Open source community for various tools and libraries
Made with β€οΈ by Parisa Roozgarian