# rafabarros95/machine-learning architecture

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

- Interactive diagram: https://gitdiagram.com/rafabarros95/machine-learning
- Repository: https://github.com/rafabarros95/machine-learning

## Overview

ML-DL is a small collection of machine-learning examples and two applied projects: phishing-email classification and bank-customer segmentation. In the phishing project, dataset loading and text preprocessing support model training and evaluation; a FastAPI interface classifies submitted email text. In customer segmentation, shared feature preparation supports model training and Streamlit prediction, with segment profiles and demographic/location context presented in the app. The repository also contains a salary-regression notebook and two forecasting notebooks. The README gives no capability details, and the customer-segmentation raw data and trained-model artifacts are not present in the tree.

Main entry points: [`Phishing_Email_Detector/src/data_loader.py`](https://github.com/rafabarros95/machine-learning/blob/main/Phishing_Email_Detector/src/data_loader.py) (Data loader), [`Phishing_Email_Detector/src/preprocess.py`](https://github.com/rafabarros95/machine-learning/blob/main/Phishing_Email_Detector/src/preprocess.py) (Text preprocessing), [`Phishing_Email_Detector/src/train.py`](https://github.com/rafabarros95/machine-learning/blob/main/Phishing_Email_Detector/src/train.py) (Model training), [`Phishing_Email_Detector/src/hyperparameter_tuning.py`](https://github.com/rafabarros95/machine-learning/blob/main/Phishing_Email_Detector/src/hyperparameter_tuning.py) (Hyperparameter tuning)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_phishing["Phishing Detection"]
  node_ph_data[("Email CSV<br/>[Phishing_Email.csv]")]
  node_loader["Data loader<br/>[data_loader.py]"]
  node_preprocess["Text preprocessing<br/>[preprocess.py]"]
  node_train["Model training<br/>[train.py]"]
  node_tuning["Hyperparameter tuning"]
  node_evaluate["Model evaluation<br/>[evaluate.py]"]
  node_predict["Batch prediction<br/>[predict.py]"]
  node_api["Prediction API<br/>[app.py]"]
  node_form["Email form<br/>[form.html]"]
  node_eda["Email exploration<br/>[EDA.ipynb]"]
end

subgraph group_segments["Customer Segmentation"]
  node_seg_app["Segmentation dashboard<br/>[app.py]"]
  node_seg_pipeline["Data and features<br/>[pipeline.py]"]
  node_seg_train["Cluster training<br/>[train.py]"]
end

subgraph group_examples["ML Notebooks"]
  node_salary["Salary regression"]
  node_salary_data[("Salary dataset<br/>[Salary_dataset.csv]")]
  node_forecast["Forecasting examples"]
  node_lstm["LSTM forecasting"]
end

node_user(("User"))

node_ph_data -->|"loads"| node_loader
node_loader -->|"feeds"| node_preprocess
node_train -->|"loads via"| node_loader
node_train -->|"preprocesses with"| node_preprocess
node_tuning -->|"loads via"| node_loader
node_tuning -->|"preprocesses with"| node_preprocess
node_evaluate -->|"loads via"| node_loader
node_evaluate -->|"preprocesses with"| node_preprocess
node_user -->|"submits email"| node_api
node_api -.->|"renders template"| node_form
node_user -->|"enters details"| node_seg_app
node_seg_app -->|"predicts with"| node_seg_pipeline
node_seg_train -->|"uses functions"| node_seg_pipeline
node_salary_data -.->|"supports example"| node_salary

click node_ph_data "https://github.com/rafabarros95/machine-learning/blob/main/Phishing_Email_Detector/data/raw/Phishing_Email.csv"
click node_loader "https://github.com/rafabarros95/machine-learning/blob/main/Phishing_Email_Detector/src/data_loader.py"
click node_preprocess "https://github.com/rafabarros95/machine-learning/blob/main/Phishing_Email_Detector/src/preprocess.py"
click node_train "https://github.com/rafabarros95/machine-learning/blob/main/Phishing_Email_Detector/src/train.py"
click node_tuning "https://github.com/rafabarros95/machine-learning/blob/main/Phishing_Email_Detector/src/hyperparameter_tuning.py"
click node_evaluate "https://github.com/rafabarros95/machine-learning/blob/main/Phishing_Email_Detector/src/evaluate.py"
click node_predict "https://github.com/rafabarros95/machine-learning/blob/main/Phishing_Email_Detector/src/predict.py"
click node_api "https://github.com/rafabarros95/machine-learning/blob/main/Phishing_Email_Detector/src/app.py"
click node_form "https://github.com/rafabarros95/machine-learning/blob/main/Phishing_Email_Detector/src/template-UI/form.html"
click node_seg_app "https://github.com/rafabarros95/machine-learning/blob/main/customer_segmentation/app.py"
click node_seg_pipeline "https://github.com/rafabarros95/machine-learning/blob/main/customer_segmentation/src/pipeline.py"
click node_seg_train "https://github.com/rafabarros95/machine-learning/blob/main/customer_segmentation/src/train.py"
click node_salary "https://github.com/rafabarros95/machine-learning/blob/main/ML_Fundamentals/linear_regression.ipynb"
click node_salary_data "https://github.com/rafabarros95/machine-learning/blob/main/ML_Fundamentals/Datasets/Salary_dataset.csv"
click node_forecast "https://github.com/rafabarros95/machine-learning/blob/main/scripts/Forecasting_ML.ipynb"
click node_lstm "https://github.com/rafabarros95/machine-learning/blob/main/scripts/LSTM_Forecasting.ipynb"
click node_eda "https://github.com/rafabarros95/machine-learning/blob/main/Phishing_Email_Detector/notebooks/EDA.ipynb"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ph_data,node_loader,node_preprocess,node_train,node_tuning,node_evaluate,node_predict,node_api,node_form,node_eda,node_user toneBlue
class node_seg_app,node_seg_pipeline,node_seg_train toneAmber
class node_salary,node_salary_data,node_forecast,node_lstm toneMint
```

## Components

### Phishing Detection

- [Email CSV](https://github.com/rafabarros95/machine-learning/blob/main/Phishing_Email_Detector/data/raw/Phishing_Email.csv): `Phishing_Email_Detector/data/raw/Phishing_Email.csv`
- [Data loader](https://github.com/rafabarros95/machine-learning/blob/main/Phishing_Email_Detector/src/data_loader.py): `Phishing_Email_Detector/src/data_loader.py`
- [Text preprocessing](https://github.com/rafabarros95/machine-learning/blob/main/Phishing_Email_Detector/src/preprocess.py): `Phishing_Email_Detector/src/preprocess.py`
- [Model training](https://github.com/rafabarros95/machine-learning/blob/main/Phishing_Email_Detector/src/train.py): `Phishing_Email_Detector/src/train.py`
- [Hyperparameter tuning](https://github.com/rafabarros95/machine-learning/blob/main/Phishing_Email_Detector/src/hyperparameter_tuning.py): `Phishing_Email_Detector/src/hyperparameter_tuning.py`
- [Model evaluation](https://github.com/rafabarros95/machine-learning/blob/main/Phishing_Email_Detector/src/evaluate.py): `Phishing_Email_Detector/src/evaluate.py`
- [Batch prediction](https://github.com/rafabarros95/machine-learning/blob/main/Phishing_Email_Detector/src/predict.py): `Phishing_Email_Detector/src/predict.py`
- [Prediction API](https://github.com/rafabarros95/machine-learning/blob/main/Phishing_Email_Detector/src/app.py): `Phishing_Email_Detector/src/app.py`
- [Email form](https://github.com/rafabarros95/machine-learning/blob/main/Phishing_Email_Detector/src/template-UI/form.html): `Phishing_Email_Detector/src/template-UI/form.html`
- [Email exploration](https://github.com/rafabarros95/machine-learning/blob/main/Phishing_Email_Detector/notebooks/EDA.ipynb): `Phishing_Email_Detector/notebooks/EDA.ipynb`

### Customer Segmentation

- [Segmentation dashboard](https://github.com/rafabarros95/machine-learning/blob/main/customer_segmentation/app.py): `customer_segmentation/app.py`
- [Data and features](https://github.com/rafabarros95/machine-learning/blob/main/customer_segmentation/src/pipeline.py): `customer_segmentation/src/pipeline.py`
- [Cluster training](https://github.com/rafabarros95/machine-learning/blob/main/customer_segmentation/src/train.py): `customer_segmentation/src/train.py`

### ML Notebooks

- [Salary regression](https://github.com/rafabarros95/machine-learning/blob/main/ML_Fundamentals/linear_regression.ipynb): `ML_Fundamentals/linear_regression.ipynb`
- [Salary dataset](https://github.com/rafabarros95/machine-learning/blob/main/ML_Fundamentals/Datasets/Salary_dataset.csv): `ML_Fundamentals/Datasets/Salary_dataset.csv`
- [Forecasting examples](https://github.com/rafabarros95/machine-learning/blob/main/scripts/Forecasting_ML.ipynb): `scripts/Forecasting_ML.ipynb`
- [LSTM forecasting](https://github.com/rafabarros95/machine-learning/blob/main/scripts/LSTM_Forecasting.ipynb): `scripts/LSTM_Forecasting.ipynb`

### Other components

- **User**

## Connections

- Email CSV → Data loader: loads (evidence: `Phishing_Email_Detector/src/data_loader.py`)
- Data loader → Text preprocessing: feeds (evidence: `Phishing_Email_Detector/src/train.py`)
- Model training → Data loader: loads via (evidence: `Phishing_Email_Detector/src/train.py`)
- Model training → Text preprocessing: preprocesses with (evidence: `Phishing_Email_Detector/src/train.py`)
- Hyperparameter tuning → Data loader: loads via (evidence: `Phishing_Email_Detector/src/hyperparameter_tuning.py`)
- Hyperparameter tuning → Text preprocessing: preprocesses with (evidence: `Phishing_Email_Detector/src/hyperparameter_tuning.py`)
- Model evaluation → Data loader: loads via (evidence: `Phishing_Email_Detector/src/evaluate.py`)
- Model evaluation → Text preprocessing: preprocesses with (evidence: `Phishing_Email_Detector/src/evaluate.py`)
- User → Prediction API: submits email (evidence: `Phishing_Email_Detector/src/app.py`)
- Prediction API → Email form: renders template
- User → Segmentation dashboard: enters details (evidence: `customer_segmentation/app.py`)
- Segmentation dashboard → Data and features: predicts with (evidence: `customer_segmentation/app.py`)
- Cluster training → Data and features: uses functions (evidence: `customer_segmentation/src/train.py`)
- Salary dataset → Salary regression: supports example
