# thieu1995/permetrics architecture

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

- Interactive diagram: https://gitdiagram.com/thieu1995/permetrics
- Repository: https://github.com/thieu1995/permetrics

## Overview

PerMetrics is a Python library for computing regression, classification, and clustering performance metrics. Users provide reference and predicted values (and, for internal clustering metrics, feature data), instantiate a metric evaluator, then call one metric or request several by name to obtain results. The package exposes three domain-specific metric classes over a shared evaluator, with data-formatting and calculation helpers beneath them. The README documents the public workflow and metric breadth; implementation relationships below rely on the supplied excerpts and SOURCE INDEX, so unsampled details are not expanded.

Main entry points: [`permetrics/evaluator.py`](https://github.com/thieu1995/permetrics/blob/master/permetrics/evaluator.py) (Metric evaluator), [`permetrics/__init__.py`](https://github.com/thieu1995/permetrics/blob/master/permetrics/__init__.py) (Package exports), [`permetrics/regression.py`](https://github.com/thieu1995/permetrics/blob/master/permetrics/regression.py) (Regression metrics), [`permetrics/classification.py`](https://github.com/thieu1995/permetrics/blob/master/permetrics/classification.py) (Classification metrics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public API"]
  node_exports["Package exports<br/>[__init__.py]"]
end

subgraph group_domains["Metric Domains"]
  node_regression["Regression metrics<br/>[regression.py]"]
  node_classification["Classification metrics<br/>[classification.py]"]
  node_clustering["Clustering metrics<br/>[clustering.py]"]
end

subgraph group_shared["Shared Evaluation"]
  node_evaluator["Metric evaluator<br/>[evaluator.py]"]
end

subgraph group_helpers["Calculation Helpers"]
  node_data["Data formatting<br/>[data_util.py]"]
  node_reg_util["Regression calculations<br/>[regressor_util.py]"]
  node_class_util["Classification calculations<br/>[classifier_util.py]"]
  node_cluster_util["Clustering calculations<br/>[cluster_util.py]"]
  node_encoder["Label encoding<br/>[encoder.py]"]
end

node_user(("Python user"))
node_results["Metric results"]

node_user -->|"imports API"| node_exports
node_exports -->|"exports"| node_evaluator
node_exports -->|"exports"| node_regression
node_exports -->|"exports"| node_classification
node_exports -->|"exports"| node_clustering
node_user -->|"provides data"| node_regression
node_user -.->|"provides labels"| node_classification
node_user -.->|"provides clusters"| node_clustering
node_regression -->|"inherits"| node_evaluator
node_classification -->|"inherits"| node_evaluator
node_clustering -->|"inherits"| node_evaluator
node_regression -->|"formats data"| node_data
node_regression -->|"uses calculations"| node_reg_util
node_classification -->|"formats data"| node_data
node_classification -->|"uses calculations"| node_class_util
node_clustering -->|"formats data"| node_data
node_clustering -->|"uses calculations"| node_cluster_util
node_data -->|"uses encoder"| node_encoder
node_evaluator -->|"returns results"| node_results
node_user -->|"requests metrics"| node_evaluator

click node_exports "https://github.com/thieu1995/permetrics/blob/master/permetrics/__init__.py"
click node_evaluator "https://github.com/thieu1995/permetrics/blob/master/permetrics/evaluator.py"
click node_regression "https://github.com/thieu1995/permetrics/blob/master/permetrics/regression.py"
click node_classification "https://github.com/thieu1995/permetrics/blob/master/permetrics/classification.py"
click node_clustering "https://github.com/thieu1995/permetrics/blob/master/permetrics/clustering.py"
click node_data "https://github.com/thieu1995/permetrics/blob/master/permetrics/utils/data_util.py"
click node_reg_util "https://github.com/thieu1995/permetrics/blob/master/permetrics/utils/regressor_util.py"
click node_class_util "https://github.com/thieu1995/permetrics/blob/master/permetrics/utils/classifier_util.py"
click node_cluster_util "https://github.com/thieu1995/permetrics/blob/master/permetrics/utils/cluster_util.py"
click node_encoder "https://github.com/thieu1995/permetrics/blob/master/permetrics/utils/encoder.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_exports,node_user toneBlue
class node_regression,node_classification,node_clustering toneAmber
class node_evaluator toneMint
class node_data,node_reg_util,node_class_util,node_cluster_util,node_encoder toneRose
class node_results toneIndigo
```

## Components

### Public API

- [Package exports](https://github.com/thieu1995/permetrics/blob/master/permetrics/__init__.py): `permetrics/__init__.py`

### Metric Domains

- [Regression metrics](https://github.com/thieu1995/permetrics/blob/master/permetrics/regression.py): `permetrics/regression.py`
- [Classification metrics](https://github.com/thieu1995/permetrics/blob/master/permetrics/classification.py): `permetrics/classification.py`
- [Clustering metrics](https://github.com/thieu1995/permetrics/blob/master/permetrics/clustering.py): `permetrics/clustering.py`

### Shared Evaluation

- [Metric evaluator](https://github.com/thieu1995/permetrics/blob/master/permetrics/evaluator.py): `permetrics/evaluator.py`

### Calculation Helpers

- [Data formatting](https://github.com/thieu1995/permetrics/blob/master/permetrics/utils/data_util.py): `permetrics/utils/data_util.py`
- [Regression calculations](https://github.com/thieu1995/permetrics/blob/master/permetrics/utils/regressor_util.py): `permetrics/utils/regressor_util.py`
- [Classification calculations](https://github.com/thieu1995/permetrics/blob/master/permetrics/utils/classifier_util.py): `permetrics/utils/classifier_util.py`
- [Clustering calculations](https://github.com/thieu1995/permetrics/blob/master/permetrics/utils/cluster_util.py): `permetrics/utils/cluster_util.py`
- [Label encoding](https://github.com/thieu1995/permetrics/blob/master/permetrics/utils/encoder.py): `permetrics/utils/encoder.py`

### Other components

- **Python user**
- **Metric results**

## Connections

- Python user → Package exports: imports API (evidence: `README.md`)
- Package exports → Metric evaluator: exports (evidence: `permetrics/__init__.py`)
- Package exports → Regression metrics: exports (evidence: `permetrics/__init__.py`)
- Package exports → Classification metrics: exports (evidence: `permetrics/__init__.py`)
- Package exports → Clustering metrics: exports (evidence: `permetrics/__init__.py`)
- Python user → Regression metrics: provides data (evidence: `README.md`)
- Python user → Classification metrics: provides labels
- Python user → Clustering metrics: provides clusters
- Regression metrics → Metric evaluator: inherits (evidence: `permetrics/regression.py`)
- Classification metrics → Metric evaluator: inherits (evidence: `permetrics/classification.py`)
- Clustering metrics → Metric evaluator: inherits (evidence: `permetrics/clustering.py`)
- Regression metrics → Data formatting: formats data (evidence: `permetrics/regression.py`)
- Regression metrics → Regression calculations: uses calculations (evidence: `permetrics/regression.py`)
- Classification metrics → Data formatting: formats data (evidence: `permetrics/classification.py`)
- Classification metrics → Classification calculations: uses calculations (evidence: `permetrics/classification.py`)
- Clustering metrics → Data formatting: formats data (evidence: `permetrics/clustering.py`)
- Clustering metrics → Clustering calculations: uses calculations (evidence: `permetrics/clustering.py`)
- Data formatting → Label encoding: uses encoder (evidence: `permetrics/utils/data_util.py`)
- Metric evaluator → Metric results: returns results (evidence: `permetrics/evaluator.py`)
- Python user → Metric evaluator: requests metrics (evidence: `README.md`)
