# alitahir-hide/ai-based-e-commerce-product-recommendation-and-categorization- architecture

> Architecture diagram of the GitHub repository alitahir-hide/ai-based-e-commerce-product-recommendation-and-categorization-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/alitahir-hide/ai-based-e-commerce-product-recommendation-and-categorization-
- Repository: https://github.com/alitahir-hide/ai-based-e-commerce-product-recommendation-and-categorization-

## Overview

This is a classroom e-commerce product categorization and recommendation prototype. Its main user workflow is to submit listing text or a shopper query through the browser or CLI, prepare catalogue text as TF-IDF features, then predict a department or rank existing catalogue rows by similarity. Separate paths support model evaluation and a PDF-style profile/ranking exercise; the full lab launcher runs Modules 1–5. The graph follows shown imports, calls and README descriptions; unsampled implementation details are omitted.

Main entry points: [`demo_predict_and_recommend.py`](https://github.com/alitahir-hide/ai-based-e-commerce-product-recommendation-and-categorization-/blob/main/demo_predict_and_recommend.py) (CLI prediction demo), [`main.py`](https://github.com/alitahir-hide/ai-based-e-commerce-product-recommendation-and-categorization-/blob/main/main.py) (Lab launcher), [`web_demo.py`](https://github.com/alitahir-hide/ai-based-e-commerce-product-recommendation-and-categorization-/blob/main/web_demo.py) (Streamlit demo), [`module_2.py`](https://github.com/alitahir-hide/ai-based-e-commerce-product-recommendation-and-categorization-/blob/main/module_2.py) (Text and TF-IDF features)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entry points"]
  node_web["Streamlit demo<br/>[web_demo.py]"]
  node_cli["CLI prediction demo"]
  node_launcher["Lab launcher<br/>[main.py]"]
  node_results["Predictions and ranked items"]
end

subgraph group_data["Catalogue preparation"]
  node_csv["Product catalogue CSV<br/>[ecommerce_data.csv]"]
  node_ingest["Dataset ingestion<br/>[module_1.py]"]
  node_features["Text and TF-IDF features<br/>[module_2.py]"]
  node_artifacts["TF-IDF snapshot<br/>[artifacts.npz]"]
end

subgraph group_models["Prediction and evaluation"]
  node_classifiers["Scratch classifiers<br/>[module_3.py]"]
  node_evaluation["Metrics and validation<br/>[module_4.py]"]
  node_traincli["Terminal evaluation"]
end

subgraph group_recommend["Recommendation and lab"]
  node_profile["PDF profile ranking<br/>[module_5.py]"]
end

node_user(("Student or shopper"))

node_user -->|"submits request"| node_web
node_user -->|"submits request"| node_cli
node_web -->|"loads pipeline"| node_cli
node_cli -->|"prepares features"| node_features
node_features -->|"loads dataset"| node_ingest
node_ingest -->|"reads rows"| node_csv
node_features -->|"saves snapshot"| node_artifacts
node_cli -->|"predicts category"| node_classifiers
node_cli -->|"ranks query"| node_profile
node_cli -->|"formats report"| node_evaluation
node_web -->|"ranks query"| node_profile
node_web -->|"evaluates models"| node_classifiers
node_traincli -->|"prepares features"| node_features
node_traincli -->|"trains models"| node_classifiers
node_traincli -->|"reports metrics"| node_evaluation
node_launcher -->|"runs stage"| node_ingest
node_launcher -->|"runs stage"| node_features
node_launcher -->|"runs stage"| node_classifiers
node_launcher -->|"runs stage"| node_evaluation
node_launcher -->|"runs stage"| node_profile
node_web -->|"displays results"| node_results
node_cli -->|"prints results"| node_results
node_profile -->|"produces rankings"| node_results

click node_web "https://github.com/alitahir-hide/ai-based-e-commerce-product-recommendation-and-categorization-/blob/main/web_demo.py"
click node_cli "https://github.com/alitahir-hide/ai-based-e-commerce-product-recommendation-and-categorization-/blob/main/demo_predict_and_recommend.py"
click node_launcher "https://github.com/alitahir-hide/ai-based-e-commerce-product-recommendation-and-categorization-/blob/main/main.py"
click node_csv "https://github.com/alitahir-hide/ai-based-e-commerce-product-recommendation-and-categorization-/blob/main/ecommerce_data.csv"
click node_ingest "https://github.com/alitahir-hide/ai-based-e-commerce-product-recommendation-and-categorization-/blob/main/module_1.py"
click node_features "https://github.com/alitahir-hide/ai-based-e-commerce-product-recommendation-and-categorization-/blob/main/module_2.py"
click node_artifacts "https://github.com/alitahir-hide/ai-based-e-commerce-product-recommendation-and-categorization-/blob/main/artifacts.npz"
click node_classifiers "https://github.com/alitahir-hide/ai-based-e-commerce-product-recommendation-and-categorization-/blob/main/module_3.py"
click node_evaluation "https://github.com/alitahir-hide/ai-based-e-commerce-product-recommendation-and-categorization-/blob/main/module_4.py"
click node_traincli "https://github.com/alitahir-hide/ai-based-e-commerce-product-recommendation-and-categorization-/blob/main/train_and_evaluate.py"
click node_profile "https://github.com/alitahir-hide/ai-based-e-commerce-product-recommendation-and-categorization-/blob/main/module_5.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_web,node_cli,node_launcher,node_results toneBlue
class node_csv,node_ingest,node_features,node_artifacts toneAmber
class node_classifiers,node_evaluation,node_traincli toneMint
class node_profile toneRose
class node_user toneIndigo
```

## Components

### User entry points

- [Streamlit demo](https://github.com/alitahir-hide/ai-based-e-commerce-product-recommendation-and-categorization-/blob/main/web_demo.py): `web_demo.py`
- [CLI prediction demo](https://github.com/alitahir-hide/ai-based-e-commerce-product-recommendation-and-categorization-/blob/main/demo_predict_and_recommend.py): `demo_predict_and_recommend.py`
- [Lab launcher](https://github.com/alitahir-hide/ai-based-e-commerce-product-recommendation-and-categorization-/blob/main/main.py): `main.py`
- **Predictions and ranked items**

### Catalogue preparation

- [Product catalogue CSV](https://github.com/alitahir-hide/ai-based-e-commerce-product-recommendation-and-categorization-/blob/main/ecommerce_data.csv): `ecommerce_data.csv`
- [Dataset ingestion](https://github.com/alitahir-hide/ai-based-e-commerce-product-recommendation-and-categorization-/blob/main/module_1.py): `module_1.py`
- [Text and TF-IDF features](https://github.com/alitahir-hide/ai-based-e-commerce-product-recommendation-and-categorization-/blob/main/module_2.py): `module_2.py`
- [TF-IDF snapshot](https://github.com/alitahir-hide/ai-based-e-commerce-product-recommendation-and-categorization-/blob/main/artifacts.npz): `artifacts.npz`

### Prediction and evaluation

- [Scratch classifiers](https://github.com/alitahir-hide/ai-based-e-commerce-product-recommendation-and-categorization-/blob/main/module_3.py): `module_3.py`
- [Metrics and validation](https://github.com/alitahir-hide/ai-based-e-commerce-product-recommendation-and-categorization-/blob/main/module_4.py): `module_4.py`
- [Terminal evaluation](https://github.com/alitahir-hide/ai-based-e-commerce-product-recommendation-and-categorization-/blob/main/train_and_evaluate.py): `train_and_evaluate.py`

### Recommendation and lab

- [PDF profile ranking](https://github.com/alitahir-hide/ai-based-e-commerce-product-recommendation-and-categorization-/blob/main/module_5.py): `module_5.py`

### Other components

- **Student or shopper**

## Connections

- Student or shopper → Streamlit demo: submits request (evidence: `README.md`)
- Student or shopper → CLI prediction demo: submits request (evidence: `README.md`)
- Streamlit demo → CLI prediction demo: loads pipeline (evidence: `web_demo.py`)
- CLI prediction demo → Text and TF-IDF features: prepares features (evidence: `demo_predict_and_recommend.py`)
- Text and TF-IDF features → Dataset ingestion: loads dataset (evidence: `module_2.py`)
- Dataset ingestion → Product catalogue CSV: reads rows (evidence: `module_1.py`)
- Text and TF-IDF features → TF-IDF snapshot: saves snapshot (evidence: `README.md`)
- CLI prediction demo → Scratch classifiers: predicts category (evidence: `demo_predict_and_recommend.py`)
- CLI prediction demo → PDF profile ranking: ranks query (evidence: `demo_predict_and_recommend.py`)
- CLI prediction demo → Metrics and validation: formats report (evidence: `demo_predict_and_recommend.py`)
- Streamlit demo → PDF profile ranking: ranks query (evidence: `web_demo.py`)
- Streamlit demo → Scratch classifiers: evaluates models (evidence: `web_demo.py`)
- Terminal evaluation → Text and TF-IDF features: prepares features (evidence: `train_and_evaluate.py`)
- Terminal evaluation → Scratch classifiers: trains models (evidence: `train_and_evaluate.py`)
- Terminal evaluation → Metrics and validation: reports metrics (evidence: `train_and_evaluate.py`)
- Lab launcher → Dataset ingestion: runs stage (evidence: `main.py`)
- Lab launcher → Text and TF-IDF features: runs stage (evidence: `main.py`)
- Lab launcher → Scratch classifiers: runs stage (evidence: `main.py`)
- Lab launcher → Metrics and validation: runs stage (evidence: `main.py`)
- Lab launcher → PDF profile ranking: runs stage (evidence: `main.py`)
- Streamlit demo → Predictions and ranked items: displays results (evidence: `web_demo.py`)
- CLI prediction demo → Predictions and ranked items: prints results (evidence: `demo_predict_and_recommend.py`)
- PDF profile ranking → Predictions and ranked items: produces rankings (evidence: `README.md`)
