# fan000n/fraud-detection-ml architecture

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

- Interactive diagram: https://gitdiagram.com/fan000n/fraud-detection-ml
- Repository: https://github.com/fan000n/fraud-detection-ml

## Overview

This repository is a notebook-led fraud-detection ML project, not a deployed transaction service. Its user-to-result workflow runs from raw-data inspection through leakage-conscious preprocessing and model comparison to threshold selection and final test-set evaluation. The README documents the notebook order and preprocessing behavior; the source excerpts show the reusable preprocessing, model-builder, and metric modules. Notebook-to-module wiring is not shown, so those links are left unverified rather than asserted.

Main entry points: [`notebooks/01_eda.ipynb`](https://github.com/fan000n/fraud-detection-ml/blob/main/notebooks/01_eda.ipynb) (Explore data), [`notebooks/02_modeling.ipynb`](https://github.com/fan000n/fraud-detection-ml/blob/main/notebooks/02_modeling.ipynb) (Compare models), [`notebooks/03_threshold_and_final_evaluation.ipynb`](https://github.com/fan000n/fraud-detection-ml/blob/main/notebooks/03_threshold_and_final_evaluation.ipynb) (Tune threshold), [`data`](https://github.com/fan000n/fraud-detection-ml/tree/main/data) (Fraud CSV data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experiments["Notebook workflow"]
  node_eda["Explore data<br/>[01_eda.ipynb]"]
  node_modeling["Compare models<br/>[02_modeling.ipynb]"]
  node_threshold["Tune threshold"]
end

subgraph group_runtime["Reusable ML code"]
  node_preprocessing["Prepare features<br/>[preprocessing.py]"]
  node_builders["Model builders<br/>[train.py]"]
  node_evaluation["Metric evaluation<br/>[evaluate.py]"]
end

subgraph group_inputs["Data and outcome"]
  node_rawdata[("Fraud CSV data")]
  node_results["Fraud metrics"]
end

node_analyst(("Project analyst"))

node_analyst -->|"runs first"| node_eda
node_rawdata -->|"inspects"| node_eda
node_eda -->|"continues to"| node_modeling
node_modeling -->|"continues to"| node_threshold
node_eda -->|"uses pipeline"| node_preprocessing
node_modeling -.->|"uses builders"| node_builders
node_threshold -.->|"uses metrics"| node_evaluation
node_threshold -->|"reports"| node_results

click node_rawdata "https://github.com/fan000n/fraud-detection-ml/tree/main/data"
click node_eda "https://github.com/fan000n/fraud-detection-ml/blob/main/notebooks/01_eda.ipynb"
click node_preprocessing "https://github.com/fan000n/fraud-detection-ml/blob/main/src/preprocessing.py"
click node_modeling "https://github.com/fan000n/fraud-detection-ml/blob/main/notebooks/02_modeling.ipynb"
click node_builders "https://github.com/fan000n/fraud-detection-ml/blob/main/src/train.py"
click node_threshold "https://github.com/fan000n/fraud-detection-ml/blob/main/notebooks/03_threshold_and_final_evaluation.ipynb"
click node_evaluation "https://github.com/fan000n/fraud-detection-ml/blob/main/src/evaluate.py"

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_eda,node_modeling,node_threshold toneBlue
class node_preprocessing,node_builders,node_evaluation toneAmber
class node_rawdata,node_results toneMint
class node_analyst toneIndigo
```

## Components

### Notebook workflow

- [Explore data](https://github.com/fan000n/fraud-detection-ml/blob/main/notebooks/01_eda.ipynb): `notebooks/01_eda.ipynb`
- [Compare models](https://github.com/fan000n/fraud-detection-ml/blob/main/notebooks/02_modeling.ipynb): `notebooks/02_modeling.ipynb`
- [Tune threshold](https://github.com/fan000n/fraud-detection-ml/blob/main/notebooks/03_threshold_and_final_evaluation.ipynb): `notebooks/03_threshold_and_final_evaluation.ipynb`

### Reusable ML code

- [Prepare features](https://github.com/fan000n/fraud-detection-ml/blob/main/src/preprocessing.py): `src/preprocessing.py`
- [Model builders](https://github.com/fan000n/fraud-detection-ml/blob/main/src/train.py): `src/train.py`
- [Metric evaluation](https://github.com/fan000n/fraud-detection-ml/blob/main/src/evaluate.py): `src/evaluate.py`

### Data and outcome

- [Fraud CSV data](https://github.com/fan000n/fraud-detection-ml/tree/main/data): `data`
- **Fraud metrics**

### Other components

- **Project analyst**

## Connections

- Project analyst → Explore data: runs first (evidence: `README.md`)
- Fraud CSV data → Explore data: inspects (evidence: `README.md`)
- Explore data → Compare models: continues to (evidence: `README.md`)
- Compare models → Tune threshold: continues to (evidence: `README.md`)
- Explore data → Prepare features: uses pipeline (evidence: `README.md`)
- Compare models → Model builders: uses builders
- Tune threshold → Metric evaluation: uses metrics
- Tune threshold → Fraud metrics: reports (evidence: `README.md`)
