# mazen14125/neural-network-for-phishing-email-detection architecture

> Architecture diagram of the GitHub repository mazen14125/neural-network-for-phishing-email-detection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mazen14125/neural-network-for-phishing-email-detection
- Repository: https://github.com/mazen14125/neural-network-for-phishing-email-detection

## Overview

##### Project type and purpose
- This is a machine-learning classification pipeline packaged in a Jupyter notebook.
- Purpose: ingest the Enron Email Dataset, preprocess text, train a Keras/TensorFlow neural network, and evaluate performance on phishing email detection.

##### File structure
- Top-level files:
- Neural Network for Phishing Email Detection.ipynb – contains all data-prep, modeling, and evaluation code.
- README.md – outlines dataset, preprocessing steps, model architecture, and results.
- No separate source folders, services, or configs—everything lives in the notebook.

##### Extract insights from the README
- Data preparation: tokenization, stemming, TF-IDF vectorization (scikit-learn)
- Model: multi-layer neural network (Keras/TensorFlow)
- Evaluation: accuracy, precision, recall (scikit-learn metrics)
- Visualization: Matplotlib & Seaborn

##### Main components
a. Data Source
- Enron Email Dataset (CSV files or database dump)
- External link (Kaggle)
b. Preprocessing Pipeline
- Tokenizer
- Stemmer
- TF-IDF Vectorizer
c. Neural Network Training
- Keras/TensorFlow model
- Layers (input, hidden, output)
- Training loop with loss and optimizer
d. Model Storage
- Saved model artifacts (HDF5 or SavedModel format)
e. Evaluation Module
- Metrics calculation (accuracy, precision, recall)
- Visualization (charts, confusion matrix)
f. Inference (optional)
- Load saved model to classify new emails

##### Architectural patterns and design principles
- Pipeline pattern: sequential data transformations
- Separation of concerns: data ingestion, preprocessing, training, evaluation
- Reproducibility: single notebook orchestrates all steps, but can be modularized into scripts

##### Technologies and libraries
- Python runtime
- Pandas & NumPy for data handling
- scikit-learn for TF-IDF and metrics
- Keras/TensorFlow for model definition and training
- Matplotlib & Seaborn for charts

##### Detail
- Exact sequence: raw emails → tokenization → stemming → vectorization → model training → metrics.
- Library dependencies on each stage.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Data Component
    README["Project Documentation\n(README.md)"]:::doc
    DS["Enron Email Dataset\n(Raw Data)"]:::data

    %% Preprocessing Pipeline
    subgraph "Preprocessing Pipeline"
        direction TB
        PreTokenizer["Tokenizer"]:::processing
        PreStemmer["Stemmer"]:::processing
        PreTFIDF["TF-IDF Vectorizer"]:::processing
    end

    %% Training and Artifacts
    NNTrain["Neural Network Training\n(Input, Hidden, Output)\nHyperparams: lr, epochs"]:::processing
    ModelStorage[(Model Artifacts)]:::storage

    %% Evaluation and Inference
    EvalModule["Evaluation & Visualization\n(Accuracy, Precision, Recall)"]:::evaluation
    Inference["Inference Module\n(New Email Classification)"]:::processing

    %% Flow
    README -.-> DS
    DS --> PreTokenizer
    PreTokenizer --> PreStemmer
    PreStemmer --> PreTFIDF
    PreTFIDF --> NNTrain
    NNTrain --> ModelStorage
    ModelStorage --> EvalModule
    ModelStorage --> Inference

    %% Click Events
    click README "https://github.com/mazen14125/neural-network-for-phishing-email-detection/blob/main/README.md"
    click DS "https://github.com/mazen14125/neural-network-for-phishing-email-detection/blob/main/Neural Network for Phishing Email Detection.ipynb"
    click PreTokenizer "https://github.com/mazen14125/neural-network-for-phishing-email-detection/blob/main/Neural Network for Phishing Email Detection.ipynb"
    click PreStemmer "https://github.com/mazen14125/neural-network-for-phishing-email-detection/blob/main/Neural Network for Phishing Email Detection.ipynb"
    click PreTFIDF "https://github.com/mazen14125/neural-network-for-phishing-email-detection/blob/main/Neural Network for Phishing Email Detection.ipynb"
    click NNTrain "https://github.com/mazen14125/neural-network-for-phishing-email-detection/blob/main/Neural Network for Phishing Email Detection.ipynb"
    click ModelStorage "https://github.com/mazen14125/neural-network-for-phishing-email-detection/blob/main/Neural Network for Phishing Email Detection.ipynb"
    click EvalModule "https://github.com/mazen14125/neural-network-for-phishing-email-detection/blob/main/Neural Network for Phishing Email Detection.ipynb"
    click Inference "https://github.com/mazen14125/neural-network-for-phishing-email-detection/blob/main/Neural Network for Phishing Email Detection.ipynb"

    %% Styles
    classDef data fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef processing fill:#90EE90,stroke:#333,stroke-width:1px
    classDef storage fill:#FFA500,stroke:#333,stroke-width:1px
    classDef evaluation fill:#DDA0DD,stroke:#333,stroke-width:1px
    classDef doc fill:#F0E68C,stroke:#333,stroke-width:1px
```
