# g0h0b1/optics-mlp architecture

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

- Interactive diagram: https://gitdiagram.com/g0h0b1/optics-mlp
- Repository: https://github.com/g0h0b1/optics-mlp

## Overview

This repository is a research notebook for evaluating whether OPTICS-derived cluster features improve city classification of IPv4 range records. The documented workflow loads and filters DB-IP data, selects and splits a city-balanced sample, fits preprocessing and clustering on training data, then compares MLP, hybrid MLP+OPTICS, and 1-NN across repeated seeds. It also produces dataset, clustering, per-city, accuracy, confusion-matrix, and PCA analyses. Source excerpts were unavailable, so relationships below rely on README documentation; the notebook’s internal implementation could not be verified.

Main entry points: [`optics_mlp_updated.ipynb`](https://github.com/g0h0b1/optics-mlp/blob/main/optics_mlp_updated.ipynb) (Grouped split)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_ingestion["Load and filter"]
  node_sampling["City sampling"]
  node_split["Grouped split"]
end

subgraph group_modeling["Modeling"]
  node_scaling["Feature scaling"]
  node_optics["OPTICS clustering"]
  node_label_transfer["Nearest-label transfer"]
  node_classifiers["Classifier comparison"]
end

subgraph group_analysis["Evaluation and reporting"]
  node_repeated_runs["Seed repetitions"]
  node_metrics["Metrics and clusters"]
  node_reports["Tables and figures"]
  node_pca["Geographic PCA"]
end

node_researcher(("Researcher"))
node_dbip[("DB-IP City Lite")]

node_researcher -->|"runs notebook"| node_ingestion
node_dbip -->|"provides CSV"| node_ingestion
node_ingestion -->|"filters records"| node_sampling
node_sampling -->|"selects ranges"| node_split
node_split -->|"fits training-only"| node_scaling
node_split -->|"fits training-only"| node_optics
node_optics -->|"supplies clusters"| node_label_transfer
node_split -->|"supplies test ranges"| node_label_transfer
node_scaling -->|"supplies features"| node_classifiers
node_label_transfer -->|"adds one-hot labels"| node_classifiers
node_split -->|"supplies labels"| node_classifiers
node_classifiers -->|"runs per seed"| node_repeated_runs
node_repeated_runs -->|"aggregates results"| node_metrics
node_metrics -->|"writes tables"| node_reports
node_sampling -->|"summarizes subset"| node_reports
node_optics -->|"reports cluster analysis"| node_reports
node_classifiers -->|"generates comparisons"| node_reports
node_sampling -->|"provides subset"| node_pca
node_pca -->|"writes PCA figure"| node_reports

click node_ingestion "https://github.com/g0h0b1/optics-mlp/blob/main/optics_mlp_updated.ipynb"
click node_sampling "https://github.com/g0h0b1/optics-mlp/blob/main/optics_mlp_updated.ipynb"
click node_split "https://github.com/g0h0b1/optics-mlp/blob/main/optics_mlp_updated.ipynb"
click node_scaling "https://github.com/g0h0b1/optics-mlp/blob/main/optics_mlp_updated.ipynb"
click node_optics "https://github.com/g0h0b1/optics-mlp/blob/main/optics_mlp_updated.ipynb"
click node_label_transfer "https://github.com/g0h0b1/optics-mlp/blob/main/optics_mlp_updated.ipynb"
click node_classifiers "https://github.com/g0h0b1/optics-mlp/blob/main/optics_mlp_updated.ipynb"
click node_repeated_runs "https://github.com/g0h0b1/optics-mlp/blob/main/optics_mlp_updated.ipynb"
click node_metrics "https://github.com/g0h0b1/optics-mlp/blob/main/optics_mlp_updated.ipynb"
click node_reports "https://github.com/g0h0b1/optics-mlp/blob/main/optics_mlp_updated.ipynb"
click node_pca "https://github.com/g0h0b1/optics-mlp/blob/main/optics_mlp_updated.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_ingestion,node_sampling,node_split toneBlue
class node_scaling,node_optics,node_label_transfer,node_classifiers,node_dbip toneAmber
class node_repeated_runs,node_metrics,node_reports,node_pca toneMint
class node_researcher toneIndigo
```

## Components

### Data preparation

- [Load and filter](https://github.com/g0h0b1/optics-mlp/blob/main/optics_mlp_updated.ipynb): `optics_mlp_updated.ipynb`
- [City sampling](https://github.com/g0h0b1/optics-mlp/blob/main/optics_mlp_updated.ipynb): `optics_mlp_updated.ipynb`
- [Grouped split](https://github.com/g0h0b1/optics-mlp/blob/main/optics_mlp_updated.ipynb): `optics_mlp_updated.ipynb`

### Modeling

- [Feature scaling](https://github.com/g0h0b1/optics-mlp/blob/main/optics_mlp_updated.ipynb): `optics_mlp_updated.ipynb`
- [OPTICS clustering](https://github.com/g0h0b1/optics-mlp/blob/main/optics_mlp_updated.ipynb): `optics_mlp_updated.ipynb`
- [Nearest-label transfer](https://github.com/g0h0b1/optics-mlp/blob/main/optics_mlp_updated.ipynb): `optics_mlp_updated.ipynb`
- [Classifier comparison](https://github.com/g0h0b1/optics-mlp/blob/main/optics_mlp_updated.ipynb): `optics_mlp_updated.ipynb`

### Evaluation and reporting

- [Seed repetitions](https://github.com/g0h0b1/optics-mlp/blob/main/optics_mlp_updated.ipynb): `optics_mlp_updated.ipynb`
- [Metrics and clusters](https://github.com/g0h0b1/optics-mlp/blob/main/optics_mlp_updated.ipynb): `optics_mlp_updated.ipynb`
- [Tables and figures](https://github.com/g0h0b1/optics-mlp/blob/main/optics_mlp_updated.ipynb): `optics_mlp_updated.ipynb`
- [Geographic PCA](https://github.com/g0h0b1/optics-mlp/blob/main/optics_mlp_updated.ipynb): `optics_mlp_updated.ipynb`

### Other components

- **Researcher**
- **DB-IP City Lite**

## Connections

- Researcher → Load and filter: runs notebook (evidence: `README.md`)
- DB-IP City Lite → Load and filter: provides CSV (evidence: `README.md`)
- Load and filter → City sampling: filters records (evidence: `README.md`)
- City sampling → Grouped split: selects ranges (evidence: `README.md`)
- Grouped split → Feature scaling: fits training-only (evidence: `README.md`)
- Grouped split → OPTICS clustering: fits training-only (evidence: `README.md`)
- OPTICS clustering → Nearest-label transfer: supplies clusters (evidence: `README.md`)
- Grouped split → Nearest-label transfer: supplies test ranges (evidence: `README.md`)
- Feature scaling → Classifier comparison: supplies features (evidence: `README.md`)
- Nearest-label transfer → Classifier comparison: adds one-hot labels (evidence: `README.md`)
- Grouped split → Classifier comparison: supplies labels (evidence: `README.md`)
- Classifier comparison → Seed repetitions: runs per seed (evidence: `README.md`)
- Seed repetitions → Metrics and clusters: aggregates results (evidence: `README.md`)
- Metrics and clusters → Tables and figures: writes tables (evidence: `README.md`)
- City sampling → Tables and figures: summarizes subset (evidence: `README.md`)
- OPTICS clustering → Tables and figures: reports cluster analysis (evidence: `README.md`)
- Classifier comparison → Tables and figures: generates comparisons (evidence: `README.md`)
- City sampling → Geographic PCA: provides subset (evidence: `README.md`)
- Geographic PCA → Tables and figures: writes PCA figure (evidence: `README.md`)
