Comparison of ML classifiers for medical image classification tasks. Covers the full pipeline: data loading, feature extraction, training, evaluation, and a prediction API.
- Statistical feature extraction from image arrays
- Three classifier architectures: Random Forest, Gradient Boosting, SVM (RBF)
- Accuracy and F1 comparison with bar chart output
- Prediction API function ready for deployment
pip install numpy scikit-learn matplotlib
python model_comparison.pyReplace generate_synthetic_data() with any of:
- MedMNIST:
pip install medmnist— standardised medical imaging benchmarks - Chest X-Ray14 (NIH): 112,000 chest X-ray images
- ISIC skin lesion: dermoscopy image classification
Replace ImageFeatureExtractor with a CNN backbone (ResNet50, EfficientNet) from PyTorch/TensorFlow for production-level performance.
| Model | Accuracy | F1 (weighted) |
|---|---|---|
| RandomForest | ~0.44 | ~0.43 |
| GradientBoosting | ~0.46 | ~0.46 |
| SVM RBF | ~0.45 | ~0.44 |
Results on synthetic data are near-random (expected). On real medical datasets, CNN backbones achieve 85-95%+ accuracy.
Python, NumPy, Scikit-learn, Matplotlib, ML model comparison, prediction API design