# jaswanthyamana/series-predictor architecture

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

- Interactive diagram: https://gitdiagram.com/jaswanthyamana/series-predictor
- Repository: https://github.com/jaswanthyamana/series-predictor

## Overview

This Flask application accepts numerical sequences and a target position through either its web interface or REST endpoint, then returns a prediction. Its hybrid predictor combines an LSTM with traditional pattern detection for arithmetic, geometric, and quadratic sequences. A separate training workflow generates and prepares examples, trains the LSTM, and saves model weights. The graph reflects the shown startup, prediction, and training relationships; the web template’s internal behavior was not sampled.

Main entry points: [`app.py`](https://github.com/jaswanthyamana/series-predictor/blob/main/app.py) (Flask application), [`predict.py`](https://github.com/jaswanthyamana/series-predictor/blob/main/predict.py) (Hybrid predictor), [`train_model.py`](https://github.com/jaswanthyamana/series-predictor/blob/main/train_model.py) (Model trainer), [`templates/index.html`](https://github.com/jaswanthyamana/series-predictor/blob/main/templates/index.html) (Web interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_webpage["Web interface<br/>[index.html]"]
  node_api["Prediction API<br/>[app.py]"]
  node_app["Flask application<br/>[app.py]"]
end

subgraph group_prediction["Prediction"]
  node_hybrid["Hybrid predictor<br/>[predict.py]"]
  node_traditional["Pattern detection<br/>[predict.py]"]
  node_lstm["LSTM predictor<br/>[predict.py]"]
  node_weights["Pre-trained weights<br/>[series_model.pth]"]
end

subgraph group_training["Model training"]
  node_trainer["Model trainer<br/>[train_model.py]"]
  node_trainingdata["Training data preparation<br/>[train_model.py]"]
end

node_user(("User"))

node_user -->|"uses"| node_webpage
node_user -->|"submits series"| node_api
node_app -->|"renders"| node_webpage
node_api -->|"routes request"| node_app
node_app -->|"calls predict"| node_hybrid
node_hybrid -->|"analyzes patterns"| node_traditional
node_hybrid -->|"predicts with LSTM"| node_lstm
node_lstm -->|"loads weights"| node_weights
node_trainer -->|"prepares examples"| node_trainingdata
node_trainer -->|"saves weights"| node_weights

click node_webpage "https://github.com/jaswanthyamana/series-predictor/blob/main/templates/index.html"
click node_api "https://github.com/jaswanthyamana/series-predictor/blob/main/app.py"
click node_app "https://github.com/jaswanthyamana/series-predictor/blob/main/app.py"
click node_hybrid "https://github.com/jaswanthyamana/series-predictor/blob/main/predict.py"
click node_traditional "https://github.com/jaswanthyamana/series-predictor/blob/main/predict.py"
click node_lstm "https://github.com/jaswanthyamana/series-predictor/blob/main/predict.py"
click node_weights "https://github.com/jaswanthyamana/series-predictor/blob/main/series_model.pth"
click node_trainer "https://github.com/jaswanthyamana/series-predictor/blob/main/train_model.py"
click node_trainingdata "https://github.com/jaswanthyamana/series-predictor/blob/main/train_model.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_webpage,node_api,node_app,node_user toneBlue
class node_hybrid,node_traditional,node_lstm,node_weights toneAmber
class node_trainer,node_trainingdata toneMint
```

## Components

### Web interface

- [Web interface](https://github.com/jaswanthyamana/series-predictor/blob/main/templates/index.html): `templates/index.html`
- [Prediction API](https://github.com/jaswanthyamana/series-predictor/blob/main/app.py): `app.py`
- [Flask application](https://github.com/jaswanthyamana/series-predictor/blob/main/app.py): `app.py`

### Prediction

- [Hybrid predictor](https://github.com/jaswanthyamana/series-predictor/blob/main/predict.py): `predict.py`
- [Pattern detection](https://github.com/jaswanthyamana/series-predictor/blob/main/predict.py): `predict.py`
- [LSTM predictor](https://github.com/jaswanthyamana/series-predictor/blob/main/predict.py): `predict.py`
- [Pre-trained weights](https://github.com/jaswanthyamana/series-predictor/blob/main/series_model.pth): `series_model.pth`

### Model training

- [Model trainer](https://github.com/jaswanthyamana/series-predictor/blob/main/train_model.py): `train_model.py`
- [Training data preparation](https://github.com/jaswanthyamana/series-predictor/blob/main/train_model.py): `train_model.py`

### Other components

- **User**

## Connections

- User → Web interface: uses (evidence: `README.md`)
- User → Prediction API: submits series (evidence: `README.md`)
- Flask application → Web interface: renders (evidence: `app.py`)
- Prediction API → Flask application: routes request (evidence: `app.py`)
- Flask application → Hybrid predictor: calls predict (evidence: `app.py`)
- Hybrid predictor → Pattern detection: analyzes patterns (evidence: `predict.py`)
- Hybrid predictor → LSTM predictor: predicts with LSTM (evidence: `predict.py`)
- LSTM predictor → Pre-trained weights: loads weights (evidence: `predict.py`)
- Model trainer → Training data preparation: prepares examples (evidence: `train_model.py`)
- Model trainer → Pre-trained weights: saves weights (evidence: `train_model.py`)
