# albertbs2/predict-bikes-availability architecture

> Architecture diagram of the GitHub repository albertbs2/predict-bikes-availability, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/albertbs2/predict-bikes-availability
- Repository: https://github.com/albertbs2/predict-bikes-availability

## Overview

##### Main Components
- Data Layer: Represent the raw and preprocessed data housed under the “data/” directory. This includes the different CSV files for training, test, and preprocessed datasets.
- Libraries & Utilities: Under “libs/”, include a component for utility functions, feature engineering, and data loading. These are the reusable functions called by different notebooks.
- Exploration & Analysis: Mark the “data_analysis.ipynb” notebook as the module responsible for exploratory data analysis and visualization.
- Model Training & Tuning: Create nodes for each model’s notebook found in “models/” (e.g., Logistic Regression, KNN, Random Forest, XGBoost, CatBoost). Emphasize that these notebooks handle training, testing, and hyperparameter tuning.
- Output & Best Parameters: Represent the “output/” sub-directory, especially “best_params/”, where JSON files store optimum parameters for each model.
- Final Results: Include “main.ipynb” as the component that uses the tuned models (especially the winning Random Forest) to generate final predictions and graphs.

##### Design the Relationships and Interactions
- Feature Engineering & Preprocessing: Illustrate a connection from the data layer to the exploration analysis notebook (data_analysis.ipynb) that uses utility functions from “libs/”.
- Final Integration: Finally, indicate how “main.ipynb” pulls together the cleaned data, tuned parameters (especially for the Random Forest model), and possibly visual outputs from the analysis, to generate final predictions/graphs.

##### Architectural Patterns and Design Principles
- Experimentation Workflow: Highlight the iterative nature of machine learning experimentation—from data analysis through multiple model training notebooks, hyperparameter tuning, and culminating in final production usage in “main.ipynb”.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Ingestion and Processing
    subgraph "Data Ingestion & Processing"
        nodeData["Data Files – data/"]:::data
        nodeLib["Libraries & Utilities – libs/"]:::library
    end

    %% Exploratory Analysis
    subgraph "Exploratory Analysis"
        nodeAnalysis["Exploratory Analysis – data_analysis.ipynb"]:::notebook
    end

    %% Model Training & Tuning
    subgraph "Model Training & Tuning"
        nodeLogReg["Logistic Regression – logreg.ipynb"]:::notebook
        nodeKNN["KNN – knn.ipynb"]:::notebook
        nodeRF["Random Forest – random_forest.ipynb"]:::notebook
        nodeXGB["XGBoost – xgboost.ipynb"]:::notebook
        nodeCat["CatBoost – catboost.ipynb"]:::notebook
        nodeNaive["Naive Model – naive.ipynb"]:::notebook
    end

    %% Output and Integration
    subgraph "Output & Final Integration"
        nodeBest["Best Params – output/best_params/"]:::output
        nodeMain["Final Results & Integration – main.ipynb"]:::notebook
    end

    %% Data Flow Connections
    nodeData -->|"ingests"| nodeLib
    nodeData -->|"provides data"| nodeAnalysis
    nodeLib -->|"processes"| nodeAnalysis

    nodeLib -->|"supports"| nodeLogReg
    nodeLib -->|"supports"| nodeKNN
    nodeLib -->|"supports"| nodeRF
    nodeLib -->|"supports"| nodeXGB
    nodeLib -->|"supports"| nodeCat
    nodeLib -->|"supports"| nodeNaive

    nodeLogReg -->|"outputs"| nodeBest
    nodeKNN -->|"outputs"| nodeBest
    nodeRF -->|"outputs"| nodeBest
    nodeXGB -->|"outputs"| nodeBest
    nodeCat -->|"outputs"| nodeBest
    nodeNaive -->|"outputs"| nodeBest

    nodeAnalysis -->|"feeds results"| nodeMain
    nodeBest -->|"integrated into"| nodeMain
    nodeData -->|"provides cleaned data"| nodeMain

    %% Click Events
    click nodeData "https://github.com/albertbs2/predict-bikes-availability/tree/main/data/"
    click nodeLib "https://github.com/albertbs2/predict-bikes-availability/tree/main/libs/"
    click nodeAnalysis "https://github.com/albertbs2/predict-bikes-availability/blob/main/data_analysis.ipynb"
    click nodeLogReg "https://github.com/albertbs2/predict-bikes-availability/blob/main/models/logreg.ipynb"
    click nodeKNN "https://github.com/albertbs2/predict-bikes-availability/blob/main/models/knn.ipynb"
    click nodeRF "https://github.com/albertbs2/predict-bikes-availability/blob/main/models/random_forest.ipynb"
    click nodeXGB "https://github.com/albertbs2/predict-bikes-availability/blob/main/models/xgboost.ipynb"
    click nodeCat "https://github.com/albertbs2/predict-bikes-availability/blob/main/models/catboost.ipynb"
    click nodeNaive "https://github.com/albertbs2/predict-bikes-availability/blob/main/models/naive.ipynb"
    click nodeBest "https://github.com/albertbs2/predict-bikes-availability/tree/main/output/best_params/"
    click nodeMain "https://github.com/albertbs2/predict-bikes-availability/blob/main/main.ipynb"

    %% Styles
    classDef notebook fill:#add8e6,stroke:#000,stroke-width:2px;
    classDef library fill:#90ee90,stroke:#000,stroke-width:2px;
    classDef data fill:#ffa500,stroke:#000,stroke-width:2px;
    classDef output fill:#dda0dd,stroke:#000,stroke-width:2px;
```
