# rimtouny/phishing-attack-detection-using-machine-learning architecture

> Architecture diagram of the GitHub repository rimtouny/phishing-attack-detection-using-machine-learning, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rimtouny/phishing-attack-detection-using-machine-learning
- Repository: https://github.com/rimtouny/phishing-attack-detection-using-machine-learning

## Overview

##### Project type and purpose
- This is a data-science/ML pipeline implemented in a Jupyter Notebook. Its primary goal is to detect phishing URLs via binary classification, using extensive feature extraction, EDA, model training (multiple classifiers), ensemble stacking/voting, and evaluation.

##### File structure
- Top‐level files:
- `Phishing-Attack-Detection.ipynb` – contains all data ingestion, feature engineering, modeling, evaluation, and visualization.
- `README.md` – describes datasets, features, modeling steps, and results.
- `LICENSE` – project license.
- No separate “src” or “notebooks” directory: the notebook drives the entire pipeline.

##### README for additional insights
- Data sources: three external URL datasets (PhishStorm, ISCX-URL2016, Kaggle).
- Pipeline steps: concatenate raw datasets → feature extraction → EDA → data cleaning/SMOTE → feature selection → model training (multiple algorithms via LazyClassifier) → bias-variance analysis → ensemble stacking/voting → champion model evaluation.
- Key libraries: pandas, scikit-learn, matplotlib, imbalanced-learn (SMOTE), LazyClassifier.

##### Main components
a. External Data Sources
- PhishStorm-URL dataset
- ISCX-URL2016 dataset
- Malicious URL Kaggle dataset
b. Data Ingestion & Preprocessing
- Data concatenation
- Initial cleaning (nulls, duplicates)
c. Feature Extraction Module
- Length/count features
- Boolean features
- Calculation-based features (entropy, ratios, malicious probability)
d. Exploratory Data Analysis (EDA)
- Statistics & visualizations (boxplots, histograms, correlations)
e. Data Cleaning & Balancing
- Null/duplicate handling
- Train/test split (80/20)
- SMOTE oversampling on training set
f. Feature Selection
- 90% repetition threshold filter
g. Modeling & Evaluation
- LazyClassifier wrapper training multiple base models (LR, SVM, DT, RF, XGBoost, etc.)
- Bias-variance decomposition analysis
- Metrics calculation (confusion matrix, F1, classification report)
h. Ensemble Module
- Select top two TPR models & top two TNR models
- Stacking classifiers for each pair
- Soft voting between the two ensembles
i. Champion Model Evaluation
- Final performance metrics visualization

##### Relationships & interactions
- Data flows from external sources → ingestion → feature extraction → EDA & cleaning → feature selection → model training/evaluation → ensembling → champion model.

##### Architectural patterns & design principles
- Pipeline pattern: sequential transformation stages.
- Modular separation: ingestion, feature extraction, modeling, ensembling.
- Ensemble design: stacking + voting classifiers.

##### Relevant technologies & frameworks
- Jupyter Notebook (or Colab) as orchestration environment.
- pandas for data manipulation.
- scikit-learn for feature engineering, modeling, metrics.
- imbalanced-learn (SMOTE) for oversampling.
- matplotlib/seaborn for visualization.
- LazyClassifier for rapid benchmarking of classifiers.

##### Elements
- Processing modules (rectangles)
- Models (rounded rectangles)
- Feedback loops (e.g., EDA → data cleaning).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Jupyter Notebook: Phishing-Attack-Detection.ipynb"
        direction TB
        DataSources[[External Data Sources]]:::datasrc
        Ingestion["Data Ingestion & Preprocessing"]:::dataop
        FeatureExt["Feature Extraction Module"]:::feature
        EDA["Exploratory Data Analysis (EDA)"]:::dataop
        Cleaning["Data Cleaning & Balancing"]:::dataop
        FeatureSel["Feature Selection"]:::feature
        Modeling["Modeling & Evaluation"]:::model
        Ensemble["Ensemble Module (Stacking & Voting)"]:::ensemble
        FinalEval["Champion Model Evaluation"]:::model

        DataSources --> Ingestion
        Ingestion --> FeatureExt
        FeatureExt --> EDA
        EDA --> Cleaning
        Cleaning --> FeatureSel
        FeatureSel --> Modeling
        Modeling --> Ensemble
        Ensemble --> FinalEval
        EDA -->|"feedback loop"| Cleaning

        click Ingestion "https://github.com/rimtouny/phishing-attack-detection-using-machine-learning/blob/main/Phishing-Attack-Detection.ipynb"
        click FeatureExt "https://github.com/rimtouny/phishing-attack-detection-using-machine-learning/blob/main/Phishing-Attack-Detection.ipynb"
        click EDA "https://github.com/rimtouny/phishing-attack-detection-using-machine-learning/blob/main/Phishing-Attack-Detection.ipynb"
        click Cleaning "https://github.com/rimtouny/phishing-attack-detection-using-machine-learning/blob/main/Phishing-Attack-Detection.ipynb"
        click FeatureSel "https://github.com/rimtouny/phishing-attack-detection-using-machine-learning/blob/main/Phishing-Attack-Detection.ipynb"
        click Modeling "https://github.com/rimtouny/phishing-attack-detection-using-machine-learning/blob/main/Phishing-Attack-Detection.ipynb"
        click Ensemble "https://github.com/rimtouny/phishing-attack-detection-using-machine-learning/blob/main/Phishing-Attack-Detection.ipynb"
        click FinalEval "https://github.com/rimtouny/phishing-attack-detection-using-machine-learning/blob/main/Phishing-Attack-Detection.ipynb"
    end

    Documentation["Project Documentation & Overview"]:::doc
    Documentation --> DataSources
    click Documentation "https://github.com/rimtouny/phishing-attack-detection-using-machine-learning/blob/main/README.md"

    classDef datasrc fill:#0099ff,stroke:#003366,color:#fff,shape:cylinder
    classDef dataop fill:#add8e6,stroke:#006699,color:#000
    classDef feature fill:#90ee90,stroke:#006600,color:#000
    classDef model fill:#ffff99,stroke:#999900,color:#000
    classDef ensemble fill:#ffcc99,stroke:#cc6600,color:#000
    classDef doc fill:#ffffff,stroke:#000000,color:#000,stroke-dasharray:5 5
```
