# nhuhth/machine_learning architecture

> Architecture diagram of the GitHub repository nhuhth/machine_learning, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nhuhth/machine_learning
- Repository: https://github.com/nhuhth/machine_learning

## Overview

##### Main Components
- Data Repositories:
- Supervised Component: “Flight_Delay/data” holds various RData and CSV files for flight and churn data.
- Unsupervised Component: “Unsupervised_Learning/Dataset” houses the retail and clustering datasets.
- Code & Processing Modules:
- Supervised: “Flight_Delay/Code” (R scripts and R Markdown files) that handle data preparation, feature selection, and modeling.
- Unsupervised: “Unsupervised_Learning/Python code” includes notebooks for association rules, RFM analysis, and dimensionality reduction.
- Function Libraries:
- “Flight_Delay/functions” contains custom R functions for metrics, summaries, and parallel processing.
- Output/Reporting:
- “Flight_Delay/output” for model predictions (CSV files).
- Various HTML outputs (like “Association-Rules.html”, “cluster.html”, “dimensionality-reduction.html”) in Unsupervised_Learning to present analysis summaries.

##### Data Flow and Component Interactions
- For the Supervised Learning (Flight_Delay):
- To the Modeling component (“Flight_Modeling.Rmd” and its associated R script outputs).
- A Functions block that supports tasks like metric calculations and summaries.
- Finalize with the Output/Prediction component where results are saved (“flight_data_predictions.csv”).
- For the Unsupervised Learning:
- Proceed to separate processing nodes for different unsupervised tasks: clustering, association rules, and dimensionality reduction.
- Detail that these processes are executed via Python notebooks (each representing a step, with results rendered to HTML outputs).

##### Architectural Patterns and Technologies
- The structure suggests a data pipeline pattern with clear separation between:
- Data ingestion/preparation
- Analysis/Model Building (using R for supervised tasks and Python for unsupervised ones)
- Reporting & Output Generation
- Technologies:
- R (e.g., for statistical computing, modeling, and parallelization using functions such as “99_doSNOW_solution.R”)
- Python (e.g., Jupyter notebooks for data clustering and association rules)
- Modular architecture wherein the custom functions library supports code reuse, and analysis scripts are well-organized into distinct tasks (data preparation, modeling, etc.).

##### Additional Details
- Be detailed in highlighting dependencies such as reliance on external libraries (for example, any parallel computing packages in R or visualization libraries in Python) even if they are implicit within each script.
- Although the project does not represent a deployable service or a full-stack application, representing the end-to-end pipeline—from raw dataset ingestion through processing, model development, and output generation—will capture the architectural essence.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Supervised Learning Pipeline"
        A["Data Repository (Supervised)"]
        X["Supervised Code Modules"]
        B["Preprocessing & Feature Engineering"]
        C["Modeling & Evaluation"]
        D["Custom Functions Library"]
        E["Prediction Output"]
        
        A --> X
        X --> B
        B --> C
        C --> E
        D -.-> B
        D -.-> C
    end

    subgraph "Unsupervised Learning Pipeline"
        F["Data Repository (Unsupervised)"]
        G["Analysis Notebooks (Unsupervised)"]
        H["Association Rules Analysis"]
        I["Clustering Analysis"]
        J["Dimensionality Reduction"]
        K["Association-Rules Report"]
        L["Cluster Report"]
        M["Dimensionality Reduction Report"]
        
        F --> G
        G --> H
        G --> I
        G --> J
        H --> K
        I --> L
        J --> M
    end

    %% Click Events
    click A "https://github.com/nhuhth/machine_learning/tree/main/Flight_Delay/data"
    click X "https://github.com/nhuhth/machine_learning/tree/main/Flight_Delay/Code"
    click D "https://github.com/nhuhth/machine_learning/tree/main/Flight_Delay/functions"
    click E "https://github.com/nhuhth/machine_learning/blob/main/Flight_Delay/output/flight_data_predictions.csv"
    click F "https://github.com/nhuhth/machine_learning/tree/main/Unsupervised_Learning/Dataset"
    click G "https://github.com/nhuhth/machine_learning/tree/main/Unsupervised_Learning/Python code"
    click K "https://github.com/nhuhth/machine_learning/blob/main/Unsupervised_Learning/Association-Rules.html"
    click L "https://github.com/nhuhth/machine_learning/blob/main/Unsupervised_Learning/cluster.html"
    click M "https://github.com/nhuhth/machine_learning/blob/main/Unsupervised_Learning/dimensionality-reduction.html"

    %% Styles
    classDef datastore fill:#B3E5FC,stroke:#0288D1,stroke-width:2px;
    classDef processing_supervised fill:#FFCDD2,stroke:#C62828,stroke-width:2px;
    classDef functions fill:#D1C4E9,stroke:#512DA8,stroke-width:2px;
    classDef output fill:#FFF9C4,stroke:#F9A825,stroke-width:2px;
    classDef processing_unsupervised fill:#C8E6C9,stroke:#2E7D32,stroke-width:2px;

    class A,F datastore;
    class X,B,C processing_supervised;
    class D functions;
    class E,K,L,M output;
    class G,H,I,J processing_unsupervised;
```
