# willkoehrsen/ai-projects architecture

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

- Interactive diagram: https://gitdiagram.com/willkoehrsen/ai-projects
- Repository: https://github.com/willkoehrsen/ai-projects

## Overview

Based on our analysis of the file tree and the brief README, this repository is a collection of distinct AI-related projects demonstrating different techniques such as Bayesian inference (both basic and using linear models), Markov Chain Monte Carlo methods, and search algorithm implementations (e.g., solving the Eight Puzzle). Although each project is fairly self-contained (with its own notebooks, data, images, and even tests), they all share a common theme of exploring artificial intelligence concepts, each implemented as Jupyter notebooks or Python scripts within its own folder.

##### Main Components
a. Bayesian Inference Module – Represented by the “bayesian_inference” folder. Include its primary notebook (bayes_rule_applied.ipynb) and supporting checkpoint files. Also indicate that outputs (images) are generated here.
b. Bayesian Linear Modeling Module – Found in “bayesian_lm”. Show its primary notebook (“Bayesian Linear Regression.ipynb”), the data subfolder (with CSV and TXT files), and the images subfolder.
c. Markov Chain Monte Carlo Module – Represented by “markov_chain_monte_carlo”. It contains its primary notebook, data files (including separate CSV files for sleep data/wake data), and images.
d. Search Algorithms Module – Based on the “search” folder, which includes not only notebooks and Python scripts (like eight_puzzle.py) but also tests, deprecated versions, and reports. This module demonstrates AI search techniques (e.g., solving puzzles) with several supporting components to validate functionality.
e. Shared or Common Resources – The “style” folder provides configuration for matplotlib styling (via a JSON file), which serves as a common resource for visualizations across experiments.

##### Relationships and Interactions
- Although each module is self-contained (processing its own data and generating outputs), they are unified by the shared use of Jupyter notebooks and Python scripts.
- There isn’t any direct intercommunication between the modules; however, you might represent a common “Runtime Environment/Execution Platform” (e.g., Jupyter Notebook or a Python interpreter) that underpins all modules.
- Shared components such as style configurations directly influence the presentation of visual outputs across modules.

##### Architectural Patterns and Design Principles
- Modularity: Each folder represents a distinct “module” that encapsulates a particular AI experiment or algorithm (e.g., Bayesian methods vs. search algorithms).
- Separation of Concerns: Data, code (notebooks and scripts), outputs (images), and tests are neatly separated within each module.
- Experimental Structure: Since these are code experiments/demos, the architecture is designed for iterative exploration rather than production deployment.
- Flexibility: The presence of deprecated and checkpoint versions (especially in the “search” folder) show that the repository is maintained to support iterative development and experimentation.

##### Relevant Technologies and Frameworks
- Jupyter Notebooks – Central to each module for interactive development and visualization.
- Python – The primary programming language used across all folders.
- Data files (CSV, TXT) – Provide the input for modeling and simulation.
- Matplotlib (implied by the style file) – Likely used for plotting graphs and images.
- Test Scripts – Present in the “search/tests” folder to validate functionality of search implementations.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Repo["Repository"]:::repo
    Runtime["Execution Environment (Jupyter/Python)"]:::runtime
    Style["Matplotlib Style"]:::config

    Repo --> Runtime

    %% Bayesian Inference Module
    subgraph "Bayesian Inference Module"
        BI_Code["Bayesian Inference Notebook"]:::code
        BI_Output["BI Images"]:::output
        BI_Code -->|"generates"| BI_Output
    end

    %% Bayesian Linear Modeling Module
    subgraph "Bayesian Linear Modeling Module"
        LM_Data["LM Data (student-mat.csv, student-por.csv, student.txt)"]:::data
        LM_Code["Bayesian LM Notebook"]:::code
        LM_Output["LM Images"]:::output
        LM_Data -->|"inputTo"| LM_Code
        LM_Code -->|"generates"| LM_Output
    end

    %% Markov Chain Monte Carlo Module
    subgraph "Markov Chain Monte Carlo Module"
        MCMC_Data["MCMC Data (sleep_data.csv, sleep_wake.csv, wake_data.csv, data_format.ipynb, checkpoints)"]:::data
        MCMC_Code["MCMC Notebook"]:::code
        MCMC_Output["MCMC Images"]:::output
        MCMC_Data -->|"inputTo"| MCMC_Code
        MCMC_Code -->|"generates"| MCMC_Output
    end

    %% Search Algorithms Module
    subgraph "Search Algorithms Module"
        Search_Notebook["Search Notebook(s)/Reports"]:::code
        Search_Script["Eight Puzzle Script"]:::code
        Search_Deprecated["Deprecated Versions"]:::deprecated
        Search_Tests["Test Suite"]:::tests
        Search_Script -->|"triggers"| Search_Notebook
        Search_Notebook -->|"validatedBy"| Search_Tests
        Search_Notebook -->|"iteratesWith"| Search_Deprecated
    end

    %% Connections from Runtime Environment to Modules' Code Components
    Runtime --> BI_Code
    Runtime --> LM_Code
    Runtime --> MCMC_Code
    Runtime --> Search_Notebook
    Runtime --> Search_Script

    %% Connections from Shared Style to Module Outputs / Reports
    Style --- BI_Output
    Style --- LM_Output
    Style --- MCMC_Output
    Style --- Search_Notebook

    %% Click Events
    click BI_Code "https://github.com/willkoehrsen/ai-projects/blob/master/bayesian_inference/bayes_rule_applied.ipynb"
    click BI_Output "https://github.com/willkoehrsen/ai-projects/tree/master/bayesian_inference/images"
    
    click LM_Code "https://github.com/willkoehrsen/ai-projects/blob/master/bayesian_lm/Bayesian Linear Regression.ipynb"
    click LM_Data "https://github.com/willkoehrsen/ai-projects/tree/master/bayesian_lm/data"
    click LM_Output "https://github.com/willkoehrsen/ai-projects/tree/master/bayesian_lm/images"
    
    click MCMC_Code "https://github.com/willkoehrsen/ai-projects/blob/master/markov_chain_monte_carlo/markov_chain_monte_carlo.ipynb"
    click MCMC_Data "https://github.com/willkoehrsen/ai-projects/tree/master/markov_chain_monte_carlo/data"
    click MCMC_Output "https://github.com/willkoehrsen/ai-projects/tree/master/markov_chain_monte_carlo/images"
    
    click Search_Script "https://github.com/willkoehrsen/ai-projects/blob/master/search/eight_puzzle.py"
    click Search_Deprecated "https://github.com/willkoehrsen/ai-projects/tree/master/search/deprecated"
    click Search_Tests "https://github.com/willkoehrsen/ai-projects/tree/master/search/tests"
    
    click Style "https://github.com/willkoehrsen/ai-projects/blob/master/style/bmh_matplotlibrc.json"

    %% Class Definitions
    classDef repo fill:#FFCDD2,stroke:#B71C1C,stroke-width:2px;
    classDef runtime fill:#F0F4C3,stroke:#827717,stroke-width:2px;
    classDef code fill:#BBDEFB,stroke:#0D47A1,stroke-width:2px;
    classDef data fill:#FFF9C4,stroke:#F9A825,stroke-width:2px;
    classDef output fill:#C8E6C9,stroke:#388E3C,stroke-width:2px;
    classDef tests fill:#F8BBD0,stroke:#C2185B,stroke-width:2px;
    classDef deprecated fill:#D7CCC8,stroke:#5D4037,stroke-width:2px;
    classDef config fill:#E1BEE7,stroke:#8E24AA,stroke-width:2px;
```
