# dheeraj1306/nyc-airbnb-room-type-predicton architecture

> Architecture diagram of the GitHub repository dheeraj1306/nyc-airbnb-room-type-predicton, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dheeraj1306/nyc-airbnb-room-type-predicton
- Repository: https://github.com/dheeraj1306/nyc-airbnb-room-type-predicton

## Overview

This is a small end-to-end NYC Airbnb room-type classifier: a user enters listing attributes in the web form, the browser sends them to FastAPI, and the API validates the request and runs the serialized preprocessing-and-model pipeline to return a class and probabilities. The UI also checks API health and visualizes prediction probabilities. The README documents EDA, preprocessing, model comparison, tuning, and evaluation in the notebook; those training stages are represented, but notebook internals were not sampled. Edges are limited to relationships shown in the excerpts or README.

Main entry points: [`main.py`](https://github.com/dheeraj1306/nyc-airbnb-room-type-predicton/blob/main/main.py) (FastAPI endpoints), [`script.js`](https://github.com/dheeraj1306/nyc-airbnb-room-type-predicton/blob/main/script.js) (Form and API logic), [`index.html`](https://github.com/dheeraj1306/nyc-airbnb-room-type-predicton/blob/main/index.html) (Listing form), [`nyc_airbnb_room_type_classification.ipynb`](https://github.com/dheeraj1306/nyc-airbnb-room-type-predicton/blob/main/nyc_airbnb_room_type_classification.ipynb) (Model comparison)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Browser frontend"]
  node_form["Listing form<br/>[index.html]"]
  node_browser["Form and API logic<br/>[script.js]"]
  node_results["Prediction display<br/>[script.js]"]
end

subgraph group_serving["Prediction service"]
  node_api["FastAPI endpoints<br/>[main.py]"]
  node_validation["Input validation<br/>[main.py]"]
  node_features["Feature row<br/>[main.py]"]
  node_pipeline["Serialized ML pipeline<br/>[Model_Pipeline.pkl]"]
end

subgraph group_ml["Model development"]
  node_notebook["EDA and preprocessing"]
  node_comparison["Model comparison"]
  node_tuning["Random Forest tuning"]
  node_evaluation["Final evaluation"]
end

node_user(("Listing user"))

node_user -->|"enters listing"| node_form
node_form -->|"submits fields"| node_browser
node_browser -->|"posts prediction"| node_api
node_browser -->|"checks health"| node_api
node_api -->|"validates request"| node_validation
node_api -->|"builds row"| node_features
node_api -->|"predicts probabilities"| node_pipeline
node_api -->|"returns prediction"| node_browser
node_browser -->|"renders result"| node_results
node_notebook -->|"compares models"| node_comparison
node_comparison -->|"tunes forest"| node_tuning
node_tuning -->|"evaluates model"| node_evaluation
node_evaluation -->|"serializes pipeline"| node_pipeline

click node_form "https://github.com/dheeraj1306/nyc-airbnb-room-type-predicton/blob/main/index.html"
click node_browser "https://github.com/dheeraj1306/nyc-airbnb-room-type-predicton/blob/main/script.js"
click node_results "https://github.com/dheeraj1306/nyc-airbnb-room-type-predicton/blob/main/script.js"
click node_api "https://github.com/dheeraj1306/nyc-airbnb-room-type-predicton/blob/main/main.py"
click node_validation "https://github.com/dheeraj1306/nyc-airbnb-room-type-predicton/blob/main/main.py"
click node_features "https://github.com/dheeraj1306/nyc-airbnb-room-type-predicton/blob/main/main.py"
click node_pipeline "https://github.com/dheeraj1306/nyc-airbnb-room-type-predicton/blob/main/Model_Pipeline.pkl"
click node_notebook "https://github.com/dheeraj1306/nyc-airbnb-room-type-predicton/blob/main/nyc_airbnb_room_type_classification.ipynb"
click node_comparison "https://github.com/dheeraj1306/nyc-airbnb-room-type-predicton/blob/main/nyc_airbnb_room_type_classification.ipynb"
click node_tuning "https://github.com/dheeraj1306/nyc-airbnb-room-type-predicton/blob/main/nyc_airbnb_room_type_classification.ipynb"
click node_evaluation "https://github.com/dheeraj1306/nyc-airbnb-room-type-predicton/blob/main/nyc_airbnb_room_type_classification.ipynb"

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_form,node_browser,node_results,node_user toneBlue
class node_api,node_validation,node_features,node_pipeline toneAmber
class node_notebook,node_comparison,node_tuning,node_evaluation toneMint
```

## Components

### Browser frontend

- [Listing form](https://github.com/dheeraj1306/nyc-airbnb-room-type-predicton/blob/main/index.html): `index.html`
- [Form and API logic](https://github.com/dheeraj1306/nyc-airbnb-room-type-predicton/blob/main/script.js): `script.js`
- [Prediction display](https://github.com/dheeraj1306/nyc-airbnb-room-type-predicton/blob/main/script.js): `script.js`

### Prediction service

- [FastAPI endpoints](https://github.com/dheeraj1306/nyc-airbnb-room-type-predicton/blob/main/main.py): `main.py`
- [Input validation](https://github.com/dheeraj1306/nyc-airbnb-room-type-predicton/blob/main/main.py): `main.py`
- [Feature row](https://github.com/dheeraj1306/nyc-airbnb-room-type-predicton/blob/main/main.py): `main.py`
- [Serialized ML pipeline](https://github.com/dheeraj1306/nyc-airbnb-room-type-predicton/blob/main/Model_Pipeline.pkl): `Model_Pipeline.pkl`

### Model development

- [EDA and preprocessing](https://github.com/dheeraj1306/nyc-airbnb-room-type-predicton/blob/main/nyc_airbnb_room_type_classification.ipynb): `nyc_airbnb_room_type_classification.ipynb`
- [Model comparison](https://github.com/dheeraj1306/nyc-airbnb-room-type-predicton/blob/main/nyc_airbnb_room_type_classification.ipynb): `nyc_airbnb_room_type_classification.ipynb`
- [Random Forest tuning](https://github.com/dheeraj1306/nyc-airbnb-room-type-predicton/blob/main/nyc_airbnb_room_type_classification.ipynb): `nyc_airbnb_room_type_classification.ipynb`
- [Final evaluation](https://github.com/dheeraj1306/nyc-airbnb-room-type-predicton/blob/main/nyc_airbnb_room_type_classification.ipynb): `nyc_airbnb_room_type_classification.ipynb`

### Other components

- **Listing user**

## Connections

- Listing user → Listing form: enters listing (evidence: `README.md`)
- Listing form → Form and API logic: submits fields (evidence: `script.js`)
- Form and API logic → FastAPI endpoints: posts prediction (evidence: `script.js`)
- Form and API logic → FastAPI endpoints: checks health (evidence: `script.js`)
- FastAPI endpoints → Input validation: validates request (evidence: `main.py`)
- FastAPI endpoints → Feature row: builds row (evidence: `main.py`)
- FastAPI endpoints → Serialized ML pipeline: predicts probabilities (evidence: `main.py`)
- FastAPI endpoints → Form and API logic: returns prediction (evidence: `main.py`)
- Form and API logic → Prediction display: renders result (evidence: `script.js`)
- EDA and preprocessing → Model comparison: compares models (evidence: `README.md`)
- Model comparison → Random Forest tuning: tunes forest (evidence: `README.md`)
- Random Forest tuning → Final evaluation: evaluates model (evidence: `README.md`)
- Final evaluation → Serialized ML pipeline: serializes pipeline (evidence: `README.md`)
