# almansur123/breast-cancer-detection architecture

> Architecture diagram of the GitHub repository almansur123/breast-cancer-detection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/almansur123/breast-cancer-detection
- Repository: https://github.com/almansur123/breast-cancer-detection

## Overview

##### Project type and purpose
- This is a machine-learning research project (not a web app or microservice).
- Its goal is to classify tumors in the Wisconsin Breast Cancer dataset, using preprocessing, feature selection, training multiple models, then explaining predictions with SHAP and LIME.

##### Main components
a. Data Ingestion
- Wisconsin Breast Cancer dataset (CSV)
- Source: local file or remote URL
b. Data Preprocessing
- Missing-value handling, encoding, scaling
- Output: cleaned DataFrame
c. Feature Selection
- Techniques: filter methods, wrapper methods
- Output: reduced feature set
d. Model Training
- Sub-components:
– Random Forest classifier (final best model, 97.37% accuracy)
– Other candidate models (Logistic Regression, SVM, etc.)
e. Model Evaluation
- Metrics: accuracy, precision, recall, ROC-AUC
- Outputs: performance reports, confusion matrix
f. Model Explanation
- SHAP explainer module
- LIME explainer module
- Outputs: feature-importance plots, local explanations
g. (Future) Deployment & Extension
- Deep-learning module (e.g., TensorFlow/Keras pipeline)
- Additional data sources (patient history, imaging)
- Model registry or serving endpoint

##### Relationships & data flow
- A directional flow: Data Source → Preprocessing → Feature Selection → Model Training → Evaluation → Explanation

##### Architectural patterns / design principles
- Pipeline pattern: stages connected in series
- Separation of concerns: data prep vs. modeling vs. interpretation
- Modularity: each stage is a separate component or script/notebook cell

##### Elements
- Compute tasks or scripts (rounded rectangles)
- Models (parallelograms or hexagons)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Data source
    DataCSV["Wisconsin Breast Cancer Dataset (CSV)"]:::data
    Readme["Project Overview / Instructions (README.md)"]:::doc

    %% Pipeline stages
    subgraph "Classification Pipeline"
        direction TB
        Preprocessing["Data Preprocessing"]:::compute
        FeatureSel["Feature Selection"]:::compute
        Training["Model Training (RF, Logistic, SVM)"]:::model
        Evaluation["Model Evaluation (Accuracy, Precision, Recall, ROC-AUC, Confusion Matrix)"]:::model
        subgraph "Model Interpretability"
            direction TB
            Explanation["Model Explanation (SHAP & LIME)"]:::explain
        end
    end

    %% Future extensions
    Future["Future Extensions (Deep Learning, Deployment)"]:::future

    %% Final report
    FinalReport["Final Report (PDF)"]:::doc

    %% Data flow
    Readme -->|"guides usage"| DataCSV
    DataCSV -->|"raw data"| Preprocessing
    Preprocessing -->|"cleaned DataFrame"| FeatureSel
    FeatureSel -->|"selected features"| Training
    Training -->|"trained model artifacts"| Evaluation
    Evaluation -->|"performance reports"| Explanation
    Explanation -->|"feature importance & local explanations"| FinalReport
    Training -->|"saved artifacts"| Future

    %% Click events
    click DataCSV "https://github.com/almansur123/breast-cancer-detection/blob/main/breast_cancer_detection.ipynb"
    click Preprocessing "https://github.com/almansur123/breast-cancer-detection/blob/main/breast_cancer_detection.ipynb"
    click FeatureSel "https://github.com/almansur123/breast-cancer-detection/blob/main/breast_cancer_detection.ipynb"
    click Training "https://github.com/almansur123/breast-cancer-detection/blob/main/breast_cancer_detection.ipynb"
    click Evaluation "https://github.com/almansur123/breast-cancer-detection/blob/main/breast_cancer_detection.ipynb"
    click Explanation "https://github.com/almansur123/breast-cancer-detection/blob/main/breast_cancer_detection.ipynb"
    click Readme "https://github.com/almansur123/breast-cancer-detection/blob/main/README.md"
    click FinalReport "https://github.com/almansur123/breast-cancer-detection/blob/main/breast_cancer_detection.pdf"

    %% Styles
    classDef data fill:#cce5ff,stroke:#339,stroke-width:1px
    classDef compute fill:#d4edda,stroke:#396,stroke-width:1px
    classDef model fill:#ffe5b4,stroke:#d68,stroke-width:1px
    classDef explain fill:#e2d5f9,stroke:#7d3cbf,stroke-width:1px
    classDef future fill:#f8d7da,stroke:#b53030,stroke-width:1px
    classDef doc fill:#f0f0f0,stroke:#999,stroke-width:1px
```
