# jarvis3954p/lna_gainnoise-predictor architecture

> Architecture diagram of the GitHub repository jarvis3954p/lna_gainnoise-predictor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jarvis3954p/lna_gainnoise-predictor
- Repository: https://github.com/jarvis3954p/lna_gainnoise-predictor

## Overview

##### Project type and purpose
- This is a full-stack machine-learning application (“LNA Performance Predictor”) that spans data ingestion, EDA, model training/evaluation, artifact serialization, and deployment via a Flask-based web interface.
- Purpose: Given LNA material, architecture, frequency, bandwidth, predict Gain and Noise Figure by loading a trained Gradient Boosting model.

##### File structure
- Top-level directories/files:
- dataset.csv (raw data)
- processed_lna_dataset.csv (cleaned/preprocessed)
- eda.ipynb (exploratory data analysis)
- model.ipynb (model training & comparison)
- prediction_app.py (wrapper to load models & scalers, perform inference)
- web_app.py (Flask application for UI & REST endpoints)
- *.pkl (model artifacts: gb_model_gain.pkl, gb_model_noise.pkl, scaler.pkl, encoder.pkl)
- requirements.txt (dependency list)
- Monolithic repo—no microservices. ML pipeline and web server co-exist.

##### README for additional insights
- ML pipeline stages: EDA → preprocessing → train/test split → train 3 regressors → evaluate (MAE, R²) → select champion model → serialize artifacts.
- Deployment: Flask app exposes a form, calls prediction_app to load .pkl artifacts, returns prediction and visualizations (Matplotlib charts).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Layer
    subgraph "Data Layer"
        RDD(("dataset.csv")):::datastore
        PDD(("processed_lna_dataset.csv")):::datastore
    end

    %% ML Pipeline
    subgraph "ML Pipeline"
        EDA["EDA Notebook\n(eda.ipynb)"]:::compute
        PRE["Preprocessing Module"]:::compute
        TRN["Training Module\n(model.ipynb)"]:::compute
        EVAL["Evaluation Module\n(MAE,R²)"]:::compute
    end

    %% Model Storage
    subgraph "Model Storage"
        ART["Model Artifacts\n(gb_model_gain.pkl\ngb_model_noise.pkl\nscaler.pkl\nencoder.pkl)"]:::artifact
    end

    %% Inference Service
    subgraph "Inference Service/API"
        INF["Inference Service\n(prediction_app.py)"]:::service
    end

    %% Web Application
    subgraph "Web Application"
        FLASK["Flask App\n(web_app.py)"]:::service
        REQ["requirements.txt"]:::service
        README["README.md"]:::service
    end

    %% User Interface
    subgraph "User Interface"
        BROW["Browser"]:::ui
    end

    %% Data Flow - Offline Pipeline
    RDD -->|"raw data"| EDA
    EDA -->|"clean data"| PRE
    PRE -->|"training data"| TRN
    TRN -->|"evaluation input"| EVAL
    EVAL -->|"artifact generation"| ART

    %% Online Inference Flow
    BROW -->|"POST material,freq,bandwidth"| FLASK
    FLASK -->|"calls"| INF
    INF -->|"loads .pkl artifacts"| ART
    ART -->|"returns models & scalers"| INF
    INF -->|"predictions"| FLASK
    FLASK -->|"renders JSON/template & charts"| BROW

    %% Visualization of metrics in web app
    EVAL -->|"MAE,R² metrics"| FLASK

    %% Click Events
    click RDD "https://github.com/jarvis3954p/lna_gainnoise-predictor/blob/main/dataset.csv"
    click PDD "https://github.com/jarvis3954p/lna_gainnoise-predictor/blob/main/processed_lna_dataset.csv"
    click EDA "https://github.com/jarvis3954p/lna_gainnoise-predictor/blob/main/eda.ipynb"
    click TRN "https://github.com/jarvis3954p/lna_gainnoise-predictor/blob/main/model.ipynb"
    click INF "https://github.com/jarvis3954p/lna_gainnoise-predictor/blob/main/prediction_app.py"
    click FLASK "https://github.com/jarvis3954p/lna_gainnoise-predictor/blob/main/web_app.py"
    click REQ "https://github.com/jarvis3954p/lna_gainnoise-predictor/blob/main/requirements.txt"
    click README "https://github.com/jarvis3954p/lna_gainnoise-predictor/blob/main/README.md"

    %% Styling
    classDef datastore fill:#bbdefb,stroke:#1e88e5,stroke-width:1px
    classDef compute fill:#c8e6c9,stroke:#388e3c,stroke-width:1px
    classDef artifact fill:#e1bee7,stroke:#8e24aa,stroke-width:1px
    classDef service fill:#ffe0b2,stroke:#f57c00,stroke-width:1px
    classDef ui fill:#fff9c4,stroke:#fbc02d,stroke-width:1px
```
