# grashanks/mlproject architecture

> Architecture diagram of the GitHub repository grashanks/mlproject, 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/grashanks/mlproject
- Repository: https://github.com/grashanks/mlproject

## Overview

This is an end-to-end student math-score regression project: training data is ingested, transformed, and used to select and save a model; a Flask form accepts student attributes and displays a prediction. The sampled training code has an apparent blocker: `ModelTrainer` calls `evaluate_models` without the required `param` argument. Transformation also saves `proprocessor.pkl`, while prediction loads `preprocessor.pkl`. Training and inference may therefore not work as written. The training flow is connected as invoked by `data_ingestion.py`'s main block; unsampled details are omitted.

Main entry points: [`app.py`](https://github.com/grashanks/mlproject/blob/main/app.py) (Flask routes), [`src/components/data_ingestion.py`](https://github.com/grashanks/mlproject/blob/main/src/components/data_ingestion.py) (Data ingestion), [`src/utils.py`](https://github.com/grashanks/mlproject/blob/main/src/utils.py) (Artifact utilities), [`src/components/data_transformation.py`](https://github.com/grashanks/mlproject/blob/main/src/components/data_transformation.py) (Feature transformation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web inference"]
  node_flask["Flask routes<br/>[app.py]"]
  node_forms["Input forms<br/>[home.html]"]
  node_landing["Landing page<br/>[index.html]"]
end

subgraph group_training["Model training"]
  node_ingestion["Data ingestion<br/>[data_ingestion.py]"]
  node_transformation["Feature transformation"]
  node_trainer["Model selection<br/>[model_trainer.py]"]
end

subgraph group_prediction["Prediction runtime"]
  node_customdata["Input dataframe"]
  node_predict["Prediction pipeline"]
  node_utils["Artifact utilities<br/>[utils.py]"]
end

subgraph group_storage["Data and artifacts"]
  node_source["Student dataset<br/>[stud.csv]"]
  node_splits["Dataset splits<br/>[train.csv]"]
  node_raw["Raw dataset copy<br/>[data.csv]"]
  node_preprocessor["Preprocessor artifact<br/>[preprocessor.pkl]"]
  node_model["Trained model<br/>[model.pkl]"]
end

node_user(("Web user"))
node_operator(("Training operator"))

node_user -->|"submits form"| node_flask
node_flask -->|"renders page"| node_landing
node_flask -->|"renders form"| node_forms
node_forms -->|"collects inputs"| node_user
node_operator -->|"starts training"| node_ingestion
node_ingestion -->|"reads dataset"| node_source
node_ingestion -->|"writes copy"| node_raw
node_ingestion -->|"writes splits"| node_splits
node_ingestion -->|"passes split paths"| node_transformation
node_transformation -->|"reads splits"| node_splits
node_transformation -->|"saves transformer"| node_preprocessor
node_ingestion -->|"passes transformed arrays"| node_trainer
node_trainer -->|"evaluates and saves"| node_utils
node_utils -->|"writes model"| node_model
node_flask -->|"creates input data"| node_customdata
node_customdata -->|"returns dataframe"| node_flask
node_flask -->|"requests prediction"| node_predict
node_predict -->|"loads artifacts"| node_utils
node_utils -->|"reads model"| node_model
node_utils -->|"reads transformer"| node_preprocessor
node_flask -->|"renders result"| node_forms

click node_flask "https://github.com/grashanks/mlproject/blob/main/app.py"
click node_forms "https://github.com/grashanks/mlproject/blob/main/templates/home.html"
click node_landing "https://github.com/grashanks/mlproject/blob/main/templates/index.html"
click node_ingestion "https://github.com/grashanks/mlproject/blob/main/src/components/data_ingestion.py"
click node_transformation "https://github.com/grashanks/mlproject/blob/main/src/components/data_transformation.py"
click node_trainer "https://github.com/grashanks/mlproject/blob/main/src/components/model_trainer.py"
click node_customdata "https://github.com/grashanks/mlproject/blob/main/src/pipeline/predict_pipeline.py"
click node_predict "https://github.com/grashanks/mlproject/blob/main/src/pipeline/predict_pipeline.py"
click node_utils "https://github.com/grashanks/mlproject/blob/main/src/utils.py"
click node_source "https://github.com/grashanks/mlproject/blob/main/notebook/data/stud.csv"
click node_splits "https://github.com/grashanks/mlproject/blob/main/artifacts/train.csv"
click node_raw "https://github.com/grashanks/mlproject/blob/main/artifacts/data.csv"
click node_preprocessor "https://github.com/grashanks/mlproject/blob/main/artifacts/preprocessor.pkl"
click node_model "https://github.com/grashanks/mlproject/blob/main/artifacts/model.pkl"

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_flask,node_forms,node_landing,node_user toneBlue
class node_ingestion,node_transformation,node_trainer toneAmber
class node_customdata,node_predict,node_utils toneMint
class node_source,node_splits,node_raw,node_preprocessor,node_model toneRose
class node_operator toneIndigo
```

## Components

### Web inference

- [Flask routes](https://github.com/grashanks/mlproject/blob/main/app.py): `app.py`
- [Input forms](https://github.com/grashanks/mlproject/blob/main/templates/home.html): `templates/home.html`
- [Landing page](https://github.com/grashanks/mlproject/blob/main/templates/index.html): `templates/index.html`

### Model training

- [Data ingestion](https://github.com/grashanks/mlproject/blob/main/src/components/data_ingestion.py): `src/components/data_ingestion.py`
- [Feature transformation](https://github.com/grashanks/mlproject/blob/main/src/components/data_transformation.py): `src/components/data_transformation.py`
- [Model selection](https://github.com/grashanks/mlproject/blob/main/src/components/model_trainer.py): `src/components/model_trainer.py`

### Prediction runtime

- [Input dataframe](https://github.com/grashanks/mlproject/blob/main/src/pipeline/predict_pipeline.py): `src/pipeline/predict_pipeline.py`
- [Prediction pipeline](https://github.com/grashanks/mlproject/blob/main/src/pipeline/predict_pipeline.py): `src/pipeline/predict_pipeline.py`
- [Artifact utilities](https://github.com/grashanks/mlproject/blob/main/src/utils.py): `src/utils.py`

### Data and artifacts

- [Student dataset](https://github.com/grashanks/mlproject/blob/main/notebook/data/stud.csv): `notebook/data/stud.csv`
- [Dataset splits](https://github.com/grashanks/mlproject/blob/main/artifacts/train.csv): `artifacts/train.csv`
- [Raw dataset copy](https://github.com/grashanks/mlproject/blob/main/artifacts/data.csv): `artifacts/data.csv`
- [Preprocessor artifact](https://github.com/grashanks/mlproject/blob/main/artifacts/preprocessor.pkl): `artifacts/preprocessor.pkl`
- [Trained model](https://github.com/grashanks/mlproject/blob/main/artifacts/model.pkl): `artifacts/model.pkl`

### Other components

- **Web user**
- **Training operator**

## Connections

- Web user → Flask routes: submits form
- Flask routes → Landing page: renders page
- Flask routes → Input forms: renders form
- Input forms → Web user: collects inputs
- Training operator → Data ingestion: starts training
- Data ingestion → Student dataset: reads dataset
- Data ingestion → Raw dataset copy: writes copy
- Data ingestion → Dataset splits: writes splits
- Data ingestion → Feature transformation: passes split paths
- Feature transformation → Dataset splits: reads splits
- Feature transformation → Preprocessor artifact: saves transformer
- Data ingestion → Model selection: passes transformed arrays
- Model selection → Artifact utilities: evaluates and saves
- Artifact utilities → Trained model: writes model
- Flask routes → Input dataframe: creates input data
- Input dataframe → Flask routes: returns dataframe
- Flask routes → Prediction pipeline: requests prediction
- Prediction pipeline → Artifact utilities: loads artifacts
- Artifact utilities → Trained model: reads model
- Artifact utilities → Preprocessor artifact: reads transformer
- Flask routes → Input forms: renders result
