# vignol-yw/linear-regression-openblas architecture

> Architecture diagram of the GitHub repository vignol-yw/linear-regression-openblas, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vignol-yw/linear-regression-openblas
- Repository: https://github.com/vignol-yw/linear-regression-openblas
- Video tour (about a minute): https://gitdiagram.com/vignol-yw/linear-regression-openblas/video

## Overview

This repository is a C implementation of multiple linear regression optimized with BLAS. The principal workflow is: run the program, load the house-price CSV, extract the target and standardize features, then train by gradient descent and return model weights. Training also records MSE history, which a separate Python script can plot. The graph follows calls and file reads/writes visible in the sampled source; the README documents normalization and BLAS optimization, while the plotting script is not invoked by the C program.

Main entry points: [`main.c`](https://github.com/vignol-yw/linear-regression-openblas/blob/main/main.c) (Training pipeline), [`src/regression.c`](https://github.com/vignol-yw/linear-regression-openblas/blob/main/src/regression.c) (Gradient descent), [`visualization/plot_history.py`](https://github.com/vignol-yw/linear-regression-openblas/blob/main/visualization/plot_history.py) (Loss plotting), [`src/csv_reader.c`](https://github.com/vignol-yw/linear-regression-openblas/blob/main/src/csv_reader.c) (CSV reader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Program entry"]
  node_main["Training pipeline<br/>[main.c]"]
end

subgraph group_data["Data preparation"]
  node_dataset["House prices"]
  node_csv_reader["CSV reader<br/>[csv_reader.c]"]
  node_preprocessing["Target extraction<br/>[utils.c]"]
  node_means["Column means<br/>[utils.c]"]
  node_stds["Column standard deviations<br/>[utils.c]"]
end

subgraph group_training["Model training"]
  node_regression["Gradient descent<br/>[regression.c]"]
  node_weights["Model weights<br/>[regression.c]"]
  node_loss_history["Loss history CSV<br/>[loss_history.csv]"]
end

subgraph group_visualization["Loss visualization"]
  node_plotter["Loss plotting<br/>[plot_history.py]"]
  node_plot["Loss curve"]
end

node_user(("Program user"))
node_blas["BLAS routines"]
node_terminal(("Console output"))

node_user -->|"runs"| node_main
node_main -->|"calls"| node_csv_reader
node_csv_reader -->|"reads"| node_dataset
node_main -->|"calls"| node_preprocessing
node_main -->|"calls"| node_means
node_main -->|"calls"| node_stds
node_main -->|"trains"| node_regression
node_regression -->|"calls"| node_blas
node_means -->|"calls"| node_blas
node_stds -->|"calls"| node_blas
node_regression -->|"returns"| node_weights
node_regression -->|"writes"| node_loss_history
node_regression -->|"prints"| node_terminal
node_plotter -.->|"reads"| node_loss_history
node_plotter -.->|"saves"| node_plot

click node_main "https://github.com/vignol-yw/linear-regression-openblas/blob/main/main.c"
click node_dataset "https://github.com/vignol-yw/linear-regression-openblas/blob/main/data/house_prices_multiple.csv"
click node_csv_reader "https://github.com/vignol-yw/linear-regression-openblas/blob/main/src/csv_reader.c"
click node_preprocessing "https://github.com/vignol-yw/linear-regression-openblas/blob/main/src/utils.c"
click node_means "https://github.com/vignol-yw/linear-regression-openblas/blob/main/src/utils.c"
click node_stds "https://github.com/vignol-yw/linear-regression-openblas/blob/main/src/utils.c"
click node_regression "https://github.com/vignol-yw/linear-regression-openblas/blob/main/src/regression.c"
click node_weights "https://github.com/vignol-yw/linear-regression-openblas/blob/main/src/regression.c"
click node_loss_history "https://github.com/vignol-yw/linear-regression-openblas/blob/main/data/loss_history.csv"
click node_plotter "https://github.com/vignol-yw/linear-regression-openblas/blob/main/visualization/plot_history.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_main,node_user toneBlue
class node_dataset,node_csv_reader,node_preprocessing,node_means,node_stds toneAmber
class node_regression,node_weights,node_loss_history toneMint
class node_plotter,node_plot toneRose
class node_blas,node_terminal toneIndigo
```

## Components

### Program entry

- [Training pipeline](https://github.com/vignol-yw/linear-regression-openblas/blob/main/main.c): `main.c`

### Data preparation

- [House prices](https://github.com/vignol-yw/linear-regression-openblas/blob/main/data/house_prices_multiple.csv): `data/house_prices_multiple.csv`
- [CSV reader](https://github.com/vignol-yw/linear-regression-openblas/blob/main/src/csv_reader.c): `src/csv_reader.c`
- [Target extraction](https://github.com/vignol-yw/linear-regression-openblas/blob/main/src/utils.c): `src/utils.c`
- [Column means](https://github.com/vignol-yw/linear-regression-openblas/blob/main/src/utils.c): `src/utils.c`
- [Column standard deviations](https://github.com/vignol-yw/linear-regression-openblas/blob/main/src/utils.c): `src/utils.c`

### Model training

- [Gradient descent](https://github.com/vignol-yw/linear-regression-openblas/blob/main/src/regression.c): `src/regression.c`
- [Model weights](https://github.com/vignol-yw/linear-regression-openblas/blob/main/src/regression.c): `src/regression.c`
- [Loss history CSV](https://github.com/vignol-yw/linear-regression-openblas/blob/main/data/loss_history.csv): `data/loss_history.csv`

### Loss visualization

- [Loss plotting](https://github.com/vignol-yw/linear-regression-openblas/blob/main/visualization/plot_history.py): `visualization/plot_history.py`
- **Loss curve**

### Other components

- **Program user**
- **BLAS routines**
- **Console output**

## Connections

- Program user → Training pipeline: runs
- Training pipeline → CSV reader: calls
- CSV reader → House prices: reads
- Training pipeline → Target extraction: calls
- Training pipeline → Column means: calls
- Training pipeline → Column standard deviations: calls
- Training pipeline → Gradient descent: trains
- Gradient descent → BLAS routines: calls
- Column means → BLAS routines: calls
- Column standard deviations → BLAS routines: calls
- Gradient descent → Model weights: returns
- Gradient descent → Loss history CSV: writes
- Gradient descent → Console output: prints
- Loss plotting → Loss history CSV: reads
- Loss plotting → Loss curve: saves
