## Results Snapshot
- Recall (malignant): ~0.90
- ROC-AUC: ~0.85
- Approach: CNN + Gradient Boosting + StackingThis project builds an end-to-end machine learning pipeline for melanoma detection from dermatoscopic images. It combines deep learning, classical models, and ensemble techniques to improve classification performance.
The focus is not just accuracy, but clinical relevance:
- Maximize detection of malignant cases (high recall)
- Minimize false negatives
- Understand model behavior through visual analysis
This system is designed as a screening tool, not a diagnostic solution.
Melanoma is a high-risk skin cancer where early detection is critical.
In this context:
- False negatives (missed melanoma) are far more costly than false positives
- The model is optimized to prioritize sensitivity (recall) over precision
Data is structured as:
melanoma_cancer_dataset/
├── train/
│ ├── benign/
│ └── malignant/
├── test/
│ ├── benign/
│ └── malignant/
- Train: 5000 benign, 4605 malignant
- Test: 500 benign, 500 malignant
The dataset is relatively balanced, enabling stable evaluation of recall-focused models.
The system is built in multiple layers:
-
Deep Learning Model (CNN)
- Learns visual features from images
- Outputs probability scores and embeddings
-
Classical Model (Gradient Boosting)
- Trained on CNN embeddings
- Captures additional non-linear patterns
-
Ensemble Layer
- Combines predictions from multiple models
-
Meta-Classifier (Stacking)
- Final decision layer
- Includes probability calibration
- Optimized threshold selection
- Image preprocessing and resizing
- Class weighting for imbalance handling
- Precision-Recall optimization
- Threshold tuning (target recall ≥ 0.90)
- Probability calibration for stable predictions
| Class | Precision | Recall | F1 Score |
|---|---|---|---|
| Benign | ~0.96 | ~0.61 | ~0.75 |
| Malignant | ~0.36 | ~0.90 | ~0.52 |
- Overall Accuracy: ~0.67
- ROC-AUC: ~0.85
- The model detects most malignant cases (high recall ~0.90)
- Precision is lower, meaning more false positives
- This trade-off is intentional and appropriate for screening systems
All graphs are stored in Graphs/.
What it shows:
Train and test distribution of benign vs malignant samples.
Interpretation:
Confirms near-balanced dataset, reducing bias toward one class.
What it shows:
Representative examples from both classes.
Interpretation:
Highlights visual variability and classification difficulty.
What it shows:
Benign images predicted as malignant.
Interpretation:
Acceptable errors in a recall-focused system; useful for understanding model confusion.
What it shows:
Baseline CNN performance.
Interpretation:
Establishes the initial precision-recall trade-off.
What it shows:
Performance after combining models and calibration.
Interpretation:
Improved stability and better trade-off than single models.
What it shows:
Final optimized model performance.
Interpretation:
Achieves strong recall while maintaining acceptable precision.
What it shows:
Initial comparison across models.
Interpretation:
Shows limitations of standalone approaches.
What it shows:
Performance improvements after ensemble tuning.
Interpretation:
Demonstrates gains from combining models.
What it shows:
Final model vs previous approaches.
Interpretation:
Confirms stacking + calibration as the best-performing approach.
What it shows:
Model tuned for balanced precision and recall.
Interpretation:
Useful when reducing false positives is important.
What it shows:
Model tuned for maximum malignant detection.
Interpretation:
Best configuration for screening scenarios.
- High recall is achievable through ensemble methods and threshold tuning
- Model stacking significantly improves performance over individual models
- Increasing recall leads to more false positives (expected trade-off)
- The system is suitable for pre-screening, not final diagnosis
- No external dataset validation (risk of overfitting)
- Limited interpretability (no Grad-CAM or explainability yet)
- Performance depends on image quality and dataset diversity
- Install dependencies:
pip install -r requirements.txt- Run the full pipeline:
- Open
melanoma_detection_v1.ipynb - Execute all cells sequentially
This project is intended for research and educational purposes only. It should not be used for clinical diagnosis without validation by medical professionals.










