# mohsin-02/mlproject architecture

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

- Interactive diagram: https://gitdiagram.com/mohsin-02/mlproject
- Repository: https://github.com/mohsin-02/mlproject

## Overview

This is a student exam-score regression project with two connected workflows: dataset exploration and model training, followed by a Flask form that turns student inputs into a predicted maths score. The documented training stages are ingestion and splitting, preprocessing, model comparison and selection, and artifact persistence; serving builds a feature row, applies saved preprocessing, and predicts. The sampled code supports the training calls from data_ingestion.py’s script entry point and the web prediction flow. The README also describes notebook model comparison; notebook internals were not sampled. Note that transformation saves `proprocessor.pkl`, while prediction loads `preprocessor.pkl`, so those paths appear inconsistent.

Main entry points: [`src/utils.py`](https://github.com/mohsin-02/mlproject/blob/main/src/utils.py) (Artifact serialization), [`app.py`](https://github.com/mohsin-02/mlproject/blob/main/app.py) (Flask routes), [`src/pipeline/predict_pipeline.py`](https://github.com/mohsin-02/mlproject/blob/main/src/pipeline/predict_pipeline.py) (Prediction pipeline), [`notebook/data/stud.csv`](https://github.com/mohsin-02/mlproject/blob/main/notebook/data/stud.csv) (Student dataset)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_training["Exploration and training"]
  node_dataset["Student dataset<br/>[stud.csv]"]
  node_eda["Data exploration"]
  node_notebook_training["Notebook training"]
  node_ingestion["Ingest and split<br/>[data_ingestion.py]"]
  node_transformation["Preprocess data"]
  node_trainer["Train and select<br/>[model_trainer.py]"]
end

subgraph group_serving["Web prediction"]
  node_web_app["Flask routes<br/>[app.py]"]
  node_landing["Landing page<br/>[index.html]"]
  node_prediction_form["Prediction form<br/>[home.html]"]
  node_custom_data["Feature row"]
  node_predictor["Prediction pipeline"]
end

subgraph group_runtime["Shared runtime"]
  node_evaluation["Model evaluation<br/>[utils.py]"]
  node_serialization["Artifact serialization<br/>[utils.py]"]
  node_artifacts["Saved artifacts"]
  node_preprocessor["Saved preprocessor<br/>[preprocessor.pkl]"]
  node_model["Saved model<br/>[model.pkl]"]
end

node_student(("Student"))

node_dataset -->|"explores"| node_eda
node_dataset -->|"trains from"| node_notebook_training
node_dataset -->|"reads"| node_ingestion
node_ingestion -->|"calls"| node_transformation
node_transformation -->|"returns arrays"| node_trainer
node_trainer -->|"evaluates models"| node_evaluation
node_trainer -->|"saves model"| node_serialization
node_transformation -->|"saves preprocessor"| node_serialization
node_serialization -->|"writes"| node_artifacts
node_student -->|"opens"| node_web_app
node_web_app -->|"renders"| node_landing
node_web_app -->|"renders"| node_prediction_form
node_student -->|"submits inputs"| node_prediction_form
node_web_app -->|"builds features"| node_custom_data
node_custom_data -->|"provides dataframe"| node_predictor
node_predictor -->|"loads artifacts via"| node_serialization
node_serialization -->|"reads"| node_preprocessor
node_serialization -->|"reads"| node_model
node_predictor -->|"transforms features"| node_preprocessor
node_predictor -->|"predicts with"| node_model
node_web_app -->|"renders result"| node_prediction_form

click node_dataset "https://github.com/mohsin-02/mlproject/blob/main/notebook/data/stud.csv"
click node_eda "https://github.com/mohsin-02/mlproject/blob/main/notebook/1%20.%20EDA%20STUDENT%20PERFORMANCE%20.ipynb"
click node_notebook_training "https://github.com/mohsin-02/mlproject/blob/main/notebook/2.%20MODEL%20TRAINING.ipynb"
click node_ingestion "https://github.com/mohsin-02/mlproject/blob/main/src/components/data_ingestion.py"
click node_transformation "https://github.com/mohsin-02/mlproject/blob/main/src/components/data_transformation.py"
click node_trainer "https://github.com/mohsin-02/mlproject/blob/main/src/components/model_trainer.py"
click node_evaluation "https://github.com/mohsin-02/mlproject/blob/main/src/utils.py"
click node_serialization "https://github.com/mohsin-02/mlproject/blob/main/src/utils.py"
click node_artifacts "https://github.com/mohsin-02/mlproject/tree/main/artifacts"
click node_web_app "https://github.com/mohsin-02/mlproject/blob/main/app.py"
click node_landing "https://github.com/mohsin-02/mlproject/blob/main/templates/index.html"
click node_prediction_form "https://github.com/mohsin-02/mlproject/blob/main/templates/home.html"
click node_custom_data "https://github.com/mohsin-02/mlproject/blob/main/src/pipeline/predict_pipeline.py"
click node_predictor "https://github.com/mohsin-02/mlproject/blob/main/src/pipeline/predict_pipeline.py"
click node_preprocessor "https://github.com/mohsin-02/mlproject/blob/main/artifacts/preprocessor.pkl"
click node_model "https://github.com/mohsin-02/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_dataset,node_eda,node_notebook_training,node_ingestion,node_transformation,node_trainer toneBlue
class node_web_app,node_landing,node_prediction_form,node_custom_data,node_predictor toneAmber
class node_evaluation,node_serialization,node_artifacts,node_preprocessor,node_model toneMint
class node_student toneIndigo
```

## Components

### Exploration and training

- [Student dataset](https://github.com/mohsin-02/mlproject/blob/main/notebook/data/stud.csv): `notebook/data/stud.csv`
- [Data exploration](https://github.com/mohsin-02/mlproject/blob/main/notebook/1%20.%20EDA%20STUDENT%20PERFORMANCE%20.ipynb): `notebook/1 . EDA STUDENT PERFORMANCE .ipynb`
- [Notebook training](https://github.com/mohsin-02/mlproject/blob/main/notebook/2.%20MODEL%20TRAINING.ipynb): `notebook/2. MODEL TRAINING.ipynb`
- [Ingest and split](https://github.com/mohsin-02/mlproject/blob/main/src/components/data_ingestion.py): `src/components/data_ingestion.py`
- [Preprocess data](https://github.com/mohsin-02/mlproject/blob/main/src/components/data_transformation.py): `src/components/data_transformation.py`
- [Train and select](https://github.com/mohsin-02/mlproject/blob/main/src/components/model_trainer.py): `src/components/model_trainer.py`

### Web prediction

- [Flask routes](https://github.com/mohsin-02/mlproject/blob/main/app.py): `app.py`
- [Landing page](https://github.com/mohsin-02/mlproject/blob/main/templates/index.html): `templates/index.html`
- [Prediction form](https://github.com/mohsin-02/mlproject/blob/main/templates/home.html): `templates/home.html`
- [Feature row](https://github.com/mohsin-02/mlproject/blob/main/src/pipeline/predict_pipeline.py): `src/pipeline/predict_pipeline.py`
- [Prediction pipeline](https://github.com/mohsin-02/mlproject/blob/main/src/pipeline/predict_pipeline.py): `src/pipeline/predict_pipeline.py`

### Shared runtime

- [Model evaluation](https://github.com/mohsin-02/mlproject/blob/main/src/utils.py): `src/utils.py`
- [Artifact serialization](https://github.com/mohsin-02/mlproject/blob/main/src/utils.py): `src/utils.py`
- [Saved artifacts](https://github.com/mohsin-02/mlproject/tree/main/artifacts): `artifacts`
- [Saved preprocessor](https://github.com/mohsin-02/mlproject/blob/main/artifacts/preprocessor.pkl): `artifacts/preprocessor.pkl`
- [Saved model](https://github.com/mohsin-02/mlproject/blob/main/artifacts/model.pkl): `artifacts/model.pkl`

### Other components

- **Student**

## Connections

- Student dataset → Data exploration: explores
- Student dataset → Notebook training: trains from
- Student dataset → Ingest and split: reads
- Ingest and split → Preprocess data: calls
- Preprocess data → Train and select: returns arrays
- Train and select → Model evaluation: evaluates models
- Train and select → Artifact serialization: saves model
- Preprocess data → Artifact serialization: saves preprocessor
- Artifact serialization → Saved artifacts: writes
- Student → Flask routes: opens
- Flask routes → Landing page: renders
- Flask routes → Prediction form: renders
- Student → Prediction form: submits inputs
- Flask routes → Feature row: builds features
- Feature row → Prediction pipeline: provides dataframe
- Prediction pipeline → Artifact serialization: loads artifacts via
- Artifact serialization → Saved preprocessor: reads
- Artifact serialization → Saved model: reads
- Prediction pipeline → Saved preprocessor: transforms features
- Prediction pipeline → Saved model: predicts with
- Flask routes → Prediction form: renders result
