# ryanbusby/qc-classification architecture

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

- Interactive diagram: https://gitdiagram.com/ryanbusby/qc-classification
- Repository: https://github.com/ryanbusby/qc-classification

## Overview

This is a Bosch production-line failure-classification pipeline: it clusters sparse measurements by shared non-null features, optionally applies per-cluster PCA, trains and selects classifiers, then predicts failures for test parts. The README documents the stages; src/run.py invokes them in order. Source excerpts show the stages’ data handoffs and persistence. Prediction code has apparent undefined-variable and syntax issues, so the intended runtime flow is represented, but successful execution is not established by the excerpts.

Main entry points: [`src/run.py`](https://github.com/ryanbusby/qc-classification/blob/master/src/run.py) (Pipeline runner), [`src/clustering.py`](https://github.com/ryanbusby/qc-classification/blob/master/src/clustering.py) (Cluster datasets), [`src/training.py`](https://github.com/ryanbusby/qc-classification/blob/master/src/training.py) (Classifier training), [`src/predict.py`](https://github.com/ryanbusby/qc-classification/blob/master/src/predict.py) (Test data loading)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_prep["Data preparation"]
  node_runner["Pipeline runner<br/>[run.py]"]
  node_source_data["Training data loading<br/>[clustering.py]"]
  node_cluster_build["Feature clustering<br/>[clustering.py]"]
  node_cluster_data[("Cluster datasets<br/>[clustering.py]")]
end

subgraph group_model["Model development"]
  node_pca_transform["Per-cluster PCA<br/>[pca.py]"]
  node_pca_data[("PCA datasets and maps<br/>[pca.py]")]
  node_train["Classifier training<br/>[training.py]"]
  node_selection["Model selection and persistence<br/>[training.py]"]
end

subgraph group_inference["Prediction"]
  node_test_data["Test data loading<br/>[predict.py]"]
  node_assignment["Row-to-cluster assignment<br/>[predict.py]"]
  node_inference["Cluster prediction<br/>[predict.py]"]
  node_submission["Prediction output<br/>[predict.py]"]
end

node_operator(("Pipeline operator"))
node_kaggle{{"Kaggle data"}}

node_operator -->|"starts pipeline"| node_runner
node_runner -->|"runs"| node_source_data
node_runner -->|"runs"| node_cluster_build
node_runner -->|"runs"| node_pca_transform
node_runner -->|"runs"| node_train
node_runner -->|"runs"| node_test_data
node_kaggle -->|"provides data"| node_source_data
node_source_data -->|"supplies measurements"| node_cluster_build
node_cluster_build -->|"writes clusters"| node_cluster_data
node_cluster_data -->|"loads clusters"| node_pca_transform
node_pca_transform -->|"writes transformed data"| node_pca_data
node_cluster_data -->|"loads clusters"| node_train
node_pca_data -->|"loads PCA data"| node_train
node_train -->|"scores classifiers"| node_selection
node_selection -.->|"persists selected models"| node_test_data
node_kaggle -.->|"provides test data"| node_test_data
node_test_data -->|"supplies measurements"| node_assignment
node_cluster_data -->|"provides feature sets"| node_assignment
node_assignment -->|"dispatches rows"| node_inference
node_selection -.->|"provides models"| node_inference
node_pca_data -->|"provides PCA maps"| node_inference
node_inference -->|"writes predictions"| node_submission

click node_runner "https://github.com/ryanbusby/qc-classification/blob/master/src/run.py"
click node_source_data "https://github.com/ryanbusby/qc-classification/blob/master/src/clustering.py"
click node_cluster_build "https://github.com/ryanbusby/qc-classification/blob/master/src/clustering.py"
click node_cluster_data "https://github.com/ryanbusby/qc-classification/blob/master/src/clustering.py"
click node_pca_transform "https://github.com/ryanbusby/qc-classification/blob/master/src/pca.py"
click node_pca_data "https://github.com/ryanbusby/qc-classification/blob/master/src/pca.py"
click node_train "https://github.com/ryanbusby/qc-classification/blob/master/src/training.py"
click node_selection "https://github.com/ryanbusby/qc-classification/blob/master/src/training.py"
click node_test_data "https://github.com/ryanbusby/qc-classification/blob/master/src/predict.py"
click node_assignment "https://github.com/ryanbusby/qc-classification/blob/master/src/predict.py"
click node_inference "https://github.com/ryanbusby/qc-classification/blob/master/src/predict.py"
click node_submission "https://github.com/ryanbusby/qc-classification/blob/master/src/predict.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_runner,node_source_data,node_cluster_build,node_cluster_data toneBlue
class node_pca_transform,node_pca_data,node_train,node_selection toneAmber
class node_test_data,node_assignment,node_inference,node_submission toneMint
class node_operator,node_kaggle toneIndigo
```

## Components

### Data preparation

- [Pipeline runner](https://github.com/ryanbusby/qc-classification/blob/master/src/run.py): `src/run.py`
- [Training data loading](https://github.com/ryanbusby/qc-classification/blob/master/src/clustering.py): `src/clustering.py`
- [Feature clustering](https://github.com/ryanbusby/qc-classification/blob/master/src/clustering.py): `src/clustering.py`
- [Cluster datasets](https://github.com/ryanbusby/qc-classification/blob/master/src/clustering.py): `src/clustering.py`

### Model development

- [Per-cluster PCA](https://github.com/ryanbusby/qc-classification/blob/master/src/pca.py): `src/pca.py`
- [PCA datasets and maps](https://github.com/ryanbusby/qc-classification/blob/master/src/pca.py): `src/pca.py`
- [Classifier training](https://github.com/ryanbusby/qc-classification/blob/master/src/training.py): `src/training.py`
- [Model selection and persistence](https://github.com/ryanbusby/qc-classification/blob/master/src/training.py): `src/training.py`

### Prediction

- [Test data loading](https://github.com/ryanbusby/qc-classification/blob/master/src/predict.py): `src/predict.py`
- [Row-to-cluster assignment](https://github.com/ryanbusby/qc-classification/blob/master/src/predict.py): `src/predict.py`
- [Cluster prediction](https://github.com/ryanbusby/qc-classification/blob/master/src/predict.py): `src/predict.py`
- [Prediction output](https://github.com/ryanbusby/qc-classification/blob/master/src/predict.py): `src/predict.py`

### Other components

- **Pipeline operator**
- **Kaggle data**

## Connections

- Pipeline operator → Pipeline runner: starts pipeline (evidence: `src/run.py`)
- Pipeline runner → Training data loading: runs (evidence: `src/run.py`)
- Pipeline runner → Feature clustering: runs (evidence: `src/run.py`)
- Pipeline runner → Per-cluster PCA: runs (evidence: `src/run.py`)
- Pipeline runner → Classifier training: runs (evidence: `src/run.py`)
- Pipeline runner → Test data loading: runs (evidence: `src/run.py`)
- Kaggle data → Training data loading: provides data (evidence: `src/clustering.py`)
- Training data loading → Feature clustering: supplies measurements (evidence: `src/clustering.py`)
- Feature clustering → Cluster datasets: writes clusters (evidence: `src/clustering.py`)
- Cluster datasets → Per-cluster PCA: loads clusters (evidence: `src/pca.py`)
- Per-cluster PCA → PCA datasets and maps: writes transformed data (evidence: `src/pca.py`)
- Cluster datasets → Classifier training: loads clusters (evidence: `src/training.py`)
- PCA datasets and maps → Classifier training: loads PCA data (evidence: `src/training.py`)
- Classifier training → Model selection and persistence: scores classifiers (evidence: `src/training.py`)
- Model selection and persistence → Test data loading: persists selected models
- Kaggle data → Test data loading: provides test data (evidence: `src/predict.py`)
- Test data loading → Row-to-cluster assignment: supplies measurements (evidence: `src/predict.py`)
- Cluster datasets → Row-to-cluster assignment: provides feature sets (evidence: `src/predict.py`)
- Row-to-cluster assignment → Cluster prediction: dispatches rows (evidence: `src/predict.py`)
- Model selection and persistence → Cluster prediction: provides models
- PCA datasets and maps → Cluster prediction: provides PCA maps (evidence: `src/predict.py`)
- Cluster prediction → Prediction output: writes predictions (evidence: `src/predict.py`)
