# spider-loki/ml-model-lab architecture

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

- Interactive diagram: https://gitdiagram.com/spider-loki/ml-model-lab
- Repository: https://github.com/spider-loki/ml-model-lab

## Overview

ML Model Lab is a small web application for house-price regression and Titanic survival classification. Users open either prediction form, submit feature values through the React UI, and receive predictions plus model metrics (and a plot for house prices). The API dispatches requests to separately trained model modules; the dataset files are inputs to those models. The sampled code shows the house and Titanic paths, but Disform uses an endpoint not present in the sampled API, so that connection is not included. Data-loading paths and some deployment details are environment-specific.

Main entry points: [`backend/main.py`](https://github.com/spider-loki/ml-model-lab/blob/main/backend/main.py) (FastAPI routes), [`frontend/src/App.jsx`](https://github.com/spider-loki/ml-model-lab/blob/main/frontend/src/App.jsx) (App shell), [`frontend/src/Linform.jsx`](https://github.com/spider-loki/ml-model-lab/blob/main/frontend/src/Linform.jsx) (House form), [`frontend/src/Logform.jsx`](https://github.com/spider-loki/ml-model-lab/blob/main/frontend/src/Logform.jsx) (Titanic form)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Frontend"]
  node_app["App shell<br/>[App.jsx]"]
  node_title["Welcome title<br/>[Title.jsx]"]
  node_houseform["House form<br/>[Linform.jsx]"]
  node_titanicform["Titanic form<br/>[Logform.jsx]"]
  node_disform["Alternate form<br/>[Disform.jsx]"]
end

subgraph group_api["API"]
  node_backend["FastAPI routes<br/>[main.py]"]
end

subgraph group_models["Prediction models"]
  node_linear["House regression<br/>[Linear_reg.py]"]
  node_logistic["Titanic classifier<br/>[Logistic_reg.py]"]
end

subgraph group_data["Datasets"]
  node_house_data["House prices<br/>[house_prices.csv]"]
  node_titanic_data["Titanic data"]
  node_test_data["Tested dataset<br/>[tested.csv]"]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"renders"| node_title
node_app -->|"renders"| node_houseform
node_app -->|"renders"| node_titanicform
node_app -->|"renders"| node_disform
node_houseform -->|"POST prediction"| node_backend
node_backend -->|"returns result"| node_houseform
node_backend -->|"calls prediction"| node_linear
node_titanicform -->|"POST prediction"| node_backend
node_backend -->|"returns result"| node_titanicform
node_backend -->|"calls prediction"| node_logistic
node_linear -.->|"loads"| node_house_data
node_logistic -.->|"loads"| node_titanic_data

click node_app "https://github.com/spider-loki/ml-model-lab/blob/main/frontend/src/App.jsx"
click node_title "https://github.com/spider-loki/ml-model-lab/blob/main/frontend/src/Title.jsx"
click node_houseform "https://github.com/spider-loki/ml-model-lab/blob/main/frontend/src/Linform.jsx"
click node_titanicform "https://github.com/spider-loki/ml-model-lab/blob/main/frontend/src/Logform.jsx"
click node_disform "https://github.com/spider-loki/ml-model-lab/blob/main/frontend/src/Disform.jsx"
click node_backend "https://github.com/spider-loki/ml-model-lab/blob/main/backend/main.py"
click node_linear "https://github.com/spider-loki/ml-model-lab/blob/main/backend/ML_models/Linear_reg.py"
click node_logistic "https://github.com/spider-loki/ml-model-lab/blob/main/backend/ML_models/Logistic_reg.py"
click node_house_data "https://github.com/spider-loki/ml-model-lab/blob/main/backend/dataset/house_prices.csv"
click node_titanic_data "https://github.com/spider-loki/ml-model-lab/blob/main/backend/dataset/Titanic-Dataset.csv"
click node_test_data "https://github.com/spider-loki/ml-model-lab/blob/main/backend/dataset/tested.csv"

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_app,node_title,node_houseform,node_titanicform,node_disform,node_user toneBlue
class node_backend toneAmber
class node_linear,node_logistic toneMint
class node_house_data,node_titanic_data,node_test_data toneRose
```

## Components

### Frontend

- [App shell](https://github.com/spider-loki/ml-model-lab/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Welcome title](https://github.com/spider-loki/ml-model-lab/blob/main/frontend/src/Title.jsx): `frontend/src/Title.jsx`
- [House form](https://github.com/spider-loki/ml-model-lab/blob/main/frontend/src/Linform.jsx): `frontend/src/Linform.jsx`
- [Titanic form](https://github.com/spider-loki/ml-model-lab/blob/main/frontend/src/Logform.jsx): `frontend/src/Logform.jsx`
- [Alternate form](https://github.com/spider-loki/ml-model-lab/blob/main/frontend/src/Disform.jsx): `frontend/src/Disform.jsx`

### API

- [FastAPI routes](https://github.com/spider-loki/ml-model-lab/blob/main/backend/main.py): `backend/main.py`

### Prediction models

- [House regression](https://github.com/spider-loki/ml-model-lab/blob/main/backend/ML_models/Linear_reg.py): `backend/ML_models/Linear_reg.py`
- [Titanic classifier](https://github.com/spider-loki/ml-model-lab/blob/main/backend/ML_models/Logistic_reg.py): `backend/ML_models/Logistic_reg.py`

### Datasets

- [House prices](https://github.com/spider-loki/ml-model-lab/blob/main/backend/dataset/house_prices.csv): `backend/dataset/house_prices.csv`
- [Titanic data](https://github.com/spider-loki/ml-model-lab/blob/main/backend/dataset/Titanic-Dataset.csv): `backend/dataset/Titanic-Dataset.csv`
- [Tested dataset](https://github.com/spider-loki/ml-model-lab/blob/main/backend/dataset/tested.csv): `backend/dataset/tested.csv`

### Other components

- **User**

## Connections

- User → App shell: uses (evidence: `frontend/src/App.jsx`)
- App shell → Welcome title: renders (evidence: `frontend/src/App.jsx`)
- App shell → House form: renders (evidence: `frontend/src/App.jsx`)
- App shell → Titanic form: renders (evidence: `frontend/src/App.jsx`)
- App shell → Alternate form: renders (evidence: `frontend/src/App.jsx`)
- House form → FastAPI routes: POST prediction (evidence: `frontend/src/Linform.jsx`)
- FastAPI routes → House form: returns result (evidence: `backend/main.py`)
- FastAPI routes → House regression: calls prediction (evidence: `backend/main.py`)
- Titanic form → FastAPI routes: POST prediction (evidence: `frontend/src/Logform.jsx`)
- FastAPI routes → Titanic form: returns result (evidence: `backend/main.py`)
- FastAPI routes → Titanic classifier: calls prediction (evidence: `backend/main.py`)
- House regression → House prices: loads
- Titanic classifier → Titanic data: loads
