# se00n00/sequence_classification_from_scratch architecture

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

- Interactive diagram: https://gitdiagram.com/se00n00/sequence_classification_from_scratch
- Repository: https://github.com/se00n00/sequence_classification_from_scratch

## Overview

This repository combines a from-scratch Transformer sequence-classification project with a deployed binary review-sentiment API and Angular client. The main user flow is entering review text or selecting a spreadsheet column, sending reviews to the API, and displaying positive/negative scores and a chart. Separately, the documented model-development workflow trains for tweet emotion classification and fine-tunes for Amazon review sentiment. API and frontend wiring is supported by sampled source; training and fine-tuning capabilities are documented in the README, but their notebook internals were not inspected.

Main entry points: [`Sentiment_Analyzer/src/app/home/home.component.ts`](https://github.com/se00n00/sequence_classification_from_scratch/blob/main/Sentiment_Analyzer/src/app/home/home.component.ts) (Home analysis), [`API/get_sentiment.py`](https://github.com/se00n00/sequence_classification_from_scratch/blob/main/API/get_sentiment.py) (Prediction API), [`trainer.ipynb`](https://github.com/se00n00/sequence_classification_from_scratch/blob/main/trainer.ipynb) (Tweet training), [`Architectures/Basic_Sequence_classification.py`](https://github.com/se00n00/sequence_classification_from_scratch/blob/main/Architectures/Basic_Sequence_classification.py) (Sequence classifier)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_home["Home analysis<br/>[home.component.ts]"]
  node_inputmode["Input mode"]
  node_app["App shell<br/>[app.ts]"]
  node_routes["Page routes<br/>[app.routes.ts]"]
  node_fallback["Not-found page"]
  node_spreadsheet["Spreadsheet parsing<br/>[home.component.ts]"]
  node_results["Scores and chart<br/>[home.component.ts]"]
end

subgraph group_serving["Sentiment API"]
  node_api["Prediction API<br/>[get_sentiment.py]"]
  node_request["Review request<br/>[get_sentiment.py]"]
  node_tokenizer["Text tokenizer<br/>[get_sentiment.py]"]
  node_onnx["ONNX inference<br/>[get_sentiment.py]"]
  node_weights["ONNX model"]
end

subgraph group_model["Classifier model"]
  node_emotion_model["Sequence classifier"]
  node_embedding["Token embeddings<br/>[embedding.py]"]
  node_encoder["Transformer encoder<br/>[encoderlayer.py]"]
  node_attention["Self-attention<br/>[attention.py]"]
  node_feedforward["Feed-forward<br/>[feedforward.py]"]
end

subgraph group_development["Model development"]
  node_training["Tweet training<br/>[trainer.ipynb]"]
  node_finetuning["Review fine-tuning<br/>[fine_tune.ipynb]"]
  node_tweetdata[("Tweet emotion data")]
  node_amazondata[("Amazon review data")]
  node_checkpoint["PyTorch checkpoint<br/>[best_model.pt]"]
  node_tracking["Experiment tracking"]
end

node_user(("User"))
node_external_api(("API consumer"))

node_user -->|"enters text"| node_home
node_user -->|"selects file"| node_spreadsheet
node_home -->|"toggles mode"| node_inputmode
node_home -->|"reads workbook"| node_spreadsheet
node_home -->|"posts reviews"| node_api
node_api -->|"validates input"| node_request
node_request -->|"tokenizes text"| node_tokenizer
node_request -->|"runs inference"| node_onnx
node_onnx -->|"loads model"| node_weights
node_api -->|"returns scores"| node_home
node_home -->|"updates results"| node_results
node_app -->|"checks health"| node_api
node_app -->|"hosts routes"| node_routes
node_routes -->|"routes home"| node_home
node_routes -->|"routes fallback"| node_fallback
node_emotion_model -->|"embeds tokens"| node_embedding
node_emotion_model -->|"encodes sequence"| node_encoder
node_encoder -->|"applies attention"| node_attention
node_encoder -->|"transforms features"| node_feedforward
node_training -->|"trains on"| node_tweetdata
node_training -->|"trains model"| node_emotion_model
node_training -->|"saves weights"| node_checkpoint
node_training -.->|"logs runs"| node_tracking
node_finetuning -->|"fine-tunes on"| node_amazondata
node_finetuning -->|"fine-tunes model"| node_emotion_model
node_finetuning -->|"saves weights"| node_checkpoint
node_external_api -->|"calls endpoints"| node_api

click node_home "https://github.com/se00n00/sequence_classification_from_scratch/blob/main/Sentiment_Analyzer/src/app/home/home.component.ts"
click node_inputmode "https://github.com/se00n00/sequence_classification_from_scratch/blob/main/Sentiment_Analyzer/src/app/input-type.service.ts"
click node_app "https://github.com/se00n00/sequence_classification_from_scratch/blob/main/Sentiment_Analyzer/src/app/app.ts"
click node_routes "https://github.com/se00n00/sequence_classification_from_scratch/blob/main/Sentiment_Analyzer/src/app/app.routes.ts"
click node_fallback "https://github.com/se00n00/sequence_classification_from_scratch/blob/main/Sentiment_Analyzer/src/app/wild-page/wild-page.component.ts"
click node_spreadsheet "https://github.com/se00n00/sequence_classification_from_scratch/blob/main/Sentiment_Analyzer/src/app/home/home.component.ts"
click node_results "https://github.com/se00n00/sequence_classification_from_scratch/blob/main/Sentiment_Analyzer/src/app/home/home.component.ts"
click node_api "https://github.com/se00n00/sequence_classification_from_scratch/blob/main/API/get_sentiment.py"
click node_request "https://github.com/se00n00/sequence_classification_from_scratch/blob/main/API/get_sentiment.py"
click node_tokenizer "https://github.com/se00n00/sequence_classification_from_scratch/blob/main/API/get_sentiment.py"
click node_onnx "https://github.com/se00n00/sequence_classification_from_scratch/blob/main/API/get_sentiment.py"
click node_weights "https://github.com/se00n00/sequence_classification_from_scratch/blob/main/API/sequence_classifier.onnx"
click node_emotion_model "https://github.com/se00n00/sequence_classification_from_scratch/blob/main/Architectures/Basic_Sequence_classification.py"
click node_embedding "https://github.com/se00n00/sequence_classification_from_scratch/blob/main/layers/embedding.py"
click node_encoder "https://github.com/se00n00/sequence_classification_from_scratch/blob/main/layers/encoderlayer.py"
click node_attention "https://github.com/se00n00/sequence_classification_from_scratch/blob/main/layers/attention.py"
click node_feedforward "https://github.com/se00n00/sequence_classification_from_scratch/blob/main/layers/feedforward.py"
click node_training "https://github.com/se00n00/sequence_classification_from_scratch/blob/main/trainer.ipynb"
click node_finetuning "https://github.com/se00n00/sequence_classification_from_scratch/blob/main/fine_tune.ipynb"
click node_checkpoint "https://github.com/se00n00/sequence_classification_from_scratch/blob/main/best_model.pt"
click node_tracking "https://github.com/se00n00/sequence_classification_from_scratch/tree/main/wandb"

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_home,node_inputmode,node_app,node_routes,node_fallback,node_spreadsheet,node_results,node_user toneBlue
class node_api,node_request,node_tokenizer,node_onnx,node_weights toneAmber
class node_emotion_model,node_embedding,node_encoder,node_attention,node_feedforward,node_external_api toneMint
class node_training,node_finetuning,node_tweetdata,node_amazondata,node_checkpoint,node_tracking toneRose
```

## Components

### Web client

- [Home analysis](https://github.com/se00n00/sequence_classification_from_scratch/blob/main/Sentiment_Analyzer/src/app/home/home.component.ts): `Sentiment_Analyzer/src/app/home/home.component.ts`
- [Input mode](https://github.com/se00n00/sequence_classification_from_scratch/blob/main/Sentiment_Analyzer/src/app/input-type.service.ts): `Sentiment_Analyzer/src/app/input-type.service.ts`
- [App shell](https://github.com/se00n00/sequence_classification_from_scratch/blob/main/Sentiment_Analyzer/src/app/app.ts): `Sentiment_Analyzer/src/app/app.ts`
- [Page routes](https://github.com/se00n00/sequence_classification_from_scratch/blob/main/Sentiment_Analyzer/src/app/app.routes.ts): `Sentiment_Analyzer/src/app/app.routes.ts`
- [Not-found page](https://github.com/se00n00/sequence_classification_from_scratch/blob/main/Sentiment_Analyzer/src/app/wild-page/wild-page.component.ts): `Sentiment_Analyzer/src/app/wild-page/wild-page.component.ts`
- [Spreadsheet parsing](https://github.com/se00n00/sequence_classification_from_scratch/blob/main/Sentiment_Analyzer/src/app/home/home.component.ts): `Sentiment_Analyzer/src/app/home/home.component.ts`
- [Scores and chart](https://github.com/se00n00/sequence_classification_from_scratch/blob/main/Sentiment_Analyzer/src/app/home/home.component.ts): `Sentiment_Analyzer/src/app/home/home.component.ts`

### Sentiment API

- [Prediction API](https://github.com/se00n00/sequence_classification_from_scratch/blob/main/API/get_sentiment.py): `API/get_sentiment.py`
- [Review request](https://github.com/se00n00/sequence_classification_from_scratch/blob/main/API/get_sentiment.py): `API/get_sentiment.py`
- [Text tokenizer](https://github.com/se00n00/sequence_classification_from_scratch/blob/main/API/get_sentiment.py): `API/get_sentiment.py`
- [ONNX inference](https://github.com/se00n00/sequence_classification_from_scratch/blob/main/API/get_sentiment.py): `API/get_sentiment.py`
- [ONNX model](https://github.com/se00n00/sequence_classification_from_scratch/blob/main/API/sequence_classifier.onnx): `API/sequence_classifier.onnx`

### Classifier model

- [Sequence classifier](https://github.com/se00n00/sequence_classification_from_scratch/blob/main/Architectures/Basic_Sequence_classification.py): `Architectures/Basic_Sequence_classification.py`
- [Token embeddings](https://github.com/se00n00/sequence_classification_from_scratch/blob/main/layers/embedding.py): `layers/embedding.py`
- [Transformer encoder](https://github.com/se00n00/sequence_classification_from_scratch/blob/main/layers/encoderlayer.py): `layers/encoderlayer.py`
- [Self-attention](https://github.com/se00n00/sequence_classification_from_scratch/blob/main/layers/attention.py): `layers/attention.py`
- [Feed-forward](https://github.com/se00n00/sequence_classification_from_scratch/blob/main/layers/feedforward.py): `layers/feedforward.py`

### Model development

- [Tweet training](https://github.com/se00n00/sequence_classification_from_scratch/blob/main/trainer.ipynb): `trainer.ipynb`
- [Review fine-tuning](https://github.com/se00n00/sequence_classification_from_scratch/blob/main/fine_tune.ipynb): `fine_tune.ipynb`
- **Tweet emotion data**
- **Amazon review data**
- [PyTorch checkpoint](https://github.com/se00n00/sequence_classification_from_scratch/blob/main/best_model.pt): `best_model.pt`
- [Experiment tracking](https://github.com/se00n00/sequence_classification_from_scratch/tree/main/wandb): `wandb`

### Other components

- **User**
- **API consumer**

## Connections

- User → Home analysis: enters text
- User → Spreadsheet parsing: selects file
- Home analysis → Input mode: toggles mode
- Home analysis → Spreadsheet parsing: reads workbook
- Home analysis → Prediction API: posts reviews
- Prediction API → Review request: validates input
- Review request → Text tokenizer: tokenizes text
- Review request → ONNX inference: runs inference
- ONNX inference → ONNX model: loads model
- Prediction API → Home analysis: returns scores
- Home analysis → Scores and chart: updates results
- App shell → Prediction API: checks health
- App shell → Page routes: hosts routes
- Page routes → Home analysis: routes home
- Page routes → Not-found page: routes fallback
- Sequence classifier → Token embeddings: embeds tokens
- Sequence classifier → Transformer encoder: encodes sequence
- Transformer encoder → Self-attention: applies attention
- Transformer encoder → Feed-forward: transforms features
- Tweet training → Tweet emotion data: trains on
- Tweet training → Sequence classifier: trains model
- Tweet training → PyTorch checkpoint: saves weights
- Tweet training → Experiment tracking: logs runs
- Review fine-tuning → Amazon review data: fine-tunes on
- Review fine-tuning → Sequence classifier: fine-tunes model
- Review fine-tuning → PyTorch checkpoint: saves weights
- API consumer → Prediction API: calls endpoints
