# 93chidiebere/timecost-gradient-machine architecture

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

- Interactive diagram: https://gitdiagram.com/93chidiebere/timecost-gradient-machine
- Repository: https://github.com/93chidiebere/timecost-gradient-machine

## Overview

tcgm is a Python framework for financial cost-sensitive classification and regression, plus recursive time-series forecasting. Users fit a classifier or regressor, then predict or evaluate financial costs; forecasters create lag/rolling/calendar features and use a regressor for recursive predictions. The graph includes the public API, objective and metric layers, and separate time-series and utility capabilities. Some model internals are only partially excerpted, so unverified helper relationships are omitted.

Main entry points: [`tcgm/models.py`](https://github.com/93chidiebere/timecost-gradient-machine/blob/main/tcgm/models.py) (Asymmetric regressor), [`tcgm/__init__.py`](https://github.com/93chidiebere/timecost-gradient-machine/blob/main/tcgm/__init__.py) (Public API), [`tcgm/metrics.py`](https://github.com/93chidiebere/timecost-gradient-machine/blob/main/tcgm/metrics.py) (Financial metrics), [`tcgm/loss.py`](https://github.com/93chidiebere/timecost-gradient-machine/blob/main/tcgm/loss.py) (Losses and derivatives)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_models["Modeling"]
  node_classifier["Cost-sensitive classifier<br/>[models.py]"]
  node_regressor["Asymmetric regressor<br/>[models.py]"]
  node_boosting_backends["Boosting backends"]
end

subgraph group_objectives["Objectives and evaluation"]
  node_losses["Losses and derivatives<br/>[loss.py]"]
  node_metrics["Financial metrics<br/>[metrics.py]"]
end

subgraph group_forecasting["Forecasting and preparation"]
  node_forecaster["Recursive forecaster<br/>[ts.py]"]
  node_encoder["Target encoder<br/>[encoders.py]"]
  node_time_splits["Walk-forward splits<br/>[utils.py]"]
  node_training_helpers["Training and drift helpers<br/>[core.py]"]
end

subgraph group_api["Public interface"]
  node_public_api["Public API<br/>[__init__.py]"]
end

node_user(("Model user"))

node_user -->|"fits and predicts"| node_classifier
node_user -->|"fits and predicts"| node_regressor
node_user -->|"fits and forecasts"| node_forecaster
node_public_api -->|"exports"| node_classifier
node_public_api -->|"exports"| node_regressor
node_public_api -->|"exports"| node_forecaster
node_public_api -->|"exports"| node_losses
node_public_api -->|"exports"| node_metrics
node_classifier -->|"uses objectives"| node_losses
node_regressor -->|"uses objectives"| node_losses
node_classifier -->|"uses metrics"| node_metrics
node_regressor -->|"uses metrics"| node_metrics
node_classifier -->|"trains with"| node_boosting_backends
node_regressor -->|"trains with"| node_boosting_backends
node_metrics -->|"evaluates losses"| node_losses
node_forecaster -->|"fits and predicts"| node_regressor

click node_public_api "https://github.com/93chidiebere/timecost-gradient-machine/blob/main/tcgm/__init__.py"
click node_classifier "https://github.com/93chidiebere/timecost-gradient-machine/blob/main/tcgm/models.py"
click node_regressor "https://github.com/93chidiebere/timecost-gradient-machine/blob/main/tcgm/models.py"
click node_losses "https://github.com/93chidiebere/timecost-gradient-machine/blob/main/tcgm/loss.py"
click node_metrics "https://github.com/93chidiebere/timecost-gradient-machine/blob/main/tcgm/metrics.py"
click node_forecaster "https://github.com/93chidiebere/timecost-gradient-machine/blob/main/tcgm/ts.py"
click node_encoder "https://github.com/93chidiebere/timecost-gradient-machine/blob/main/tcgm/encoders.py"
click node_time_splits "https://github.com/93chidiebere/timecost-gradient-machine/blob/main/tcgm/utils.py"
click node_training_helpers "https://github.com/93chidiebere/timecost-gradient-machine/blob/main/tcgm/core.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_classifier,node_regressor,node_boosting_backends,node_user toneBlue
class node_losses,node_metrics toneAmber
class node_forecaster,node_encoder,node_time_splits,node_training_helpers toneMint
class node_public_api toneRose
```

## Components

### Modeling

- [Cost-sensitive classifier](https://github.com/93chidiebere/timecost-gradient-machine/blob/main/tcgm/models.py): `tcgm/models.py`
- [Asymmetric regressor](https://github.com/93chidiebere/timecost-gradient-machine/blob/main/tcgm/models.py): `tcgm/models.py`
- **Boosting backends**

### Objectives and evaluation

- [Losses and derivatives](https://github.com/93chidiebere/timecost-gradient-machine/blob/main/tcgm/loss.py): `tcgm/loss.py`
- [Financial metrics](https://github.com/93chidiebere/timecost-gradient-machine/blob/main/tcgm/metrics.py): `tcgm/metrics.py`

### Forecasting and preparation

- [Recursive forecaster](https://github.com/93chidiebere/timecost-gradient-machine/blob/main/tcgm/ts.py): `tcgm/ts.py`
- [Target encoder](https://github.com/93chidiebere/timecost-gradient-machine/blob/main/tcgm/encoders.py): `tcgm/encoders.py`
- [Walk-forward splits](https://github.com/93chidiebere/timecost-gradient-machine/blob/main/tcgm/utils.py): `tcgm/utils.py`
- [Training and drift helpers](https://github.com/93chidiebere/timecost-gradient-machine/blob/main/tcgm/core.py): `tcgm/core.py`

### Public interface

- [Public API](https://github.com/93chidiebere/timecost-gradient-machine/blob/main/tcgm/__init__.py): `tcgm/__init__.py`

### Other components

- **Model user**

## Connections

- Model user → Cost-sensitive classifier: fits and predicts (evidence: `README.md`)
- Model user → Asymmetric regressor: fits and predicts (evidence: `README.md`)
- Model user → Recursive forecaster: fits and forecasts (evidence: `README.md`)
- Public API → Cost-sensitive classifier: exports (evidence: `tcgm/__init__.py`)
- Public API → Asymmetric regressor: exports (evidence: `tcgm/__init__.py`)
- Public API → Recursive forecaster: exports (evidence: `tcgm/__init__.py`)
- Public API → Losses and derivatives: exports (evidence: `tcgm/__init__.py`)
- Public API → Financial metrics: exports (evidence: `tcgm/__init__.py`)
- Cost-sensitive classifier → Losses and derivatives: uses objectives (evidence: `tcgm/models.py`)
- Asymmetric regressor → Losses and derivatives: uses objectives (evidence: `tcgm/models.py`)
- Cost-sensitive classifier → Financial metrics: uses metrics (evidence: `tcgm/models.py`)
- Asymmetric regressor → Financial metrics: uses metrics (evidence: `tcgm/models.py`)
- Cost-sensitive classifier → Boosting backends: trains with (evidence: `tcgm/models.py`)
- Asymmetric regressor → Boosting backends: trains with (evidence: `tcgm/models.py`)
- Financial metrics → Losses and derivatives: evaluates losses (evidence: `tcgm/metrics.py`)
- Recursive forecaster → Asymmetric regressor: fits and predicts (evidence: `tcgm/ts.py`)
