# ayhanoruc/ml-collection architecture

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

- Interactive diagram: https://gitdiagram.com/ayhanoruc/ml-collection
- Repository: https://github.com/ayhanoruc/ml-collection

## Overview

##### Project Type and Purpose
- This is an open‑source, educational “ML‑from‑scratch” toolkit and code repository. Its goal is to provide minimal, self‑contained Python implementations of core machine‑learning and deep‑learning algorithms (linear & logistic regression, MLP, CNN, RNN, LSTM/GRU) plus Jupyter notebooks for hands‑on study.

##### File‑Structure Analysis
- Top‐level directories:
- data/          – sample datasets and utility scripts
- ml‑from‑scratch/   – basic ML algorithms (linear & logistic regression)
- dl‑from‑scratch/   – deep‑learning builds (subfolders: mlp/, cnn/)
- genai‑from‑scratch/– generative AI RNN/LSTM notebooks & code
- Patterns:
- Each algorithm family lives in its own namespace.
- There are pure‐Python modules (e.g., auto_tensor.py, neural_structures.py) plus Jupyter notebooks demonstrating usage.
- No external services, just local code + data.

##### README Insights
- Check‑list style shows which components are implemented vs. planned.

- Data Layer:
– ten_animals/ (dataset)
– markdown_images/ (assets)
– translate.py (helper script)
- Compute Layer – ML Core (green rectangle)
- linear_regression.py
- logistic_regression.py
- Compute Layer – DL Core (green rectangle subdivided):
- MLP Submodule: auto_tensor.py → neural_structures.py → trainer.py
- CNN Submodule: utils.py + notebooks (backprop, pooling, modern_architectures…)
- Compute Layer – GenAI Core (green rectangle subdivided):
- RNN Submodule: dataset.py + rnn notebooks
- LSTM/GRU Submodule: lstm.ipynb, gru.ipynb (future scope)
- Presentation Layer:
- All .ipynb demo files, grouped under each core

## Diagram (Mermaid)

```mermaid
flowchart TD
  %% Data Layer
  subgraph "Data Layer"
    direction TB
    DA[(data/)]:::data
    DM["markdown_images/"]:::data
    DR["ten_animals.rar"]:::data
    DT["translate.py"]:::data
    DA --> DM
    DA --> DR
    DA --> DT
  end

  %% Compute Layer
  subgraph "Compute Layer"
    direction TB
    %% ML Core
    subgraph "ML Core"
      direction TB
      ML1["linear_regression.py"]:::compute
      ML2["logistic_regression.py"]:::compute
    end
    %% DL MLP Core
    subgraph "DL-MLP Core"
      direction TB
      MLP1["auto_tensor.py"]:::compute
      MLP2["neural_structures.py"]:::compute
      MLP3["trainer.py"]:::compute
      MLP4["classification_demo.py"]:::compute
      MLP5("snippets.ipynb"):::presentation
      MLP1 --> MLP2 --> MLP3 --> MLP4
    end
    %% DL CNN Core
    subgraph "DL-CNN Core"
      direction TB
      CNN1["utils.py"]:::compute
      CNN2("backprop.ipynb"):::presentation
      CNN3("custom_,dataset_and_dataloaders.ipynb"):::presentation
      CNN4("manuel_conv.ipynb"):::presentation
      CNN5("modern_architectures.ipynb"):::presentation
      CNN6("pooling_and_flattening.ipynb"):::presentation
      CNN7("predefined_kernels.ipynb"):::presentation
      CNN8("training_and_validating.ipynb"):::presentation
      CNN1 --> CNN2
      CNN1 --> CNN3
      CNN1 --> CNN4
      CNN1 --> CNN5
      CNN1 --> CNN6
      CNN1 --> CNN7
      CNN1 --> CNN8
    end
    %% GenAI Core
    subgraph "GenAI Core"
      direction TB
      %% RNN
      subgraph "RNN Submodule"
        direction TB
        R1["dataset.py"]:::compute
        R2("generic_RNN.ipynb"):::presentation
        R3("char_level_rnn.ipynb"):::presentation
        R4("many_to_one_rnn.ipynb"):::presentation
        R5("rnn_on_timseries.ipynb"):::presentation
        R6("rnn_w_tf.ipynb"):::presentation
        R7("rnn_w_torch.ipynb"):::presentation
        R1 --> R2
        R1 --> R3
        R1 --> R4
        R1 --> R5
        R1 --> R6
        R1 --> R7
      end
      %% LSTM/GRU
      subgraph "LSTM/GRU Submodule"
        direction TB
        L1("lstm.ipynb"):::presentation
        L2("gru.ipynb"):::presentation
      end
    end
  end

  %% Presentation Layer
  subgraph "Presentation Layer"
    direction TB
    NB1("classification_demo.py Notebook"):::presentation
    NB2("backprop Notebook"):::presentation
    NB3("rnn notebooks"):::presentation
    NB1 --> DA
  end

  %% Extension Layer
  subgraph "Extension Layer" 
    direction TB
    class Extension dashed
    ET1["ml/decision_tree"]:::extension
    ET2["genai/transformers"]:::extension
  end

  %% Relationships
  DA --> ML1
  DA --> MLP1
  DA --> CNN1
  DA --> R1
  ML1 -->|"imports"| MLP1
  MLP4 -->|"used by"| MLP5
  ML1 --> NB1
  CNN1 --> NB2
  R1 --> NB3
  NB1 --> DA
  NB2 --> DA
  NB3 --> DA

  %% Click Events
  click DA "https://github.com/ayhanoruc/ml-collection/tree/main/data/"
  click DM "https://github.com/ayhanoruc/ml-collection/tree/main/data/markdown_images/"
  click DR "https://github.com/ayhanoruc/ml-collection/blob/main/data/ten_animals.rar"
  click DT "https://github.com/ayhanoruc/ml-collection/blob/main/data/ten_animals/translate.py"
  click ML1 "https://github.com/ayhanoruc/ml-collection/blob/main/ml-from-scratch/linear_regression.py"
  click ML2 "https://github.com/ayhanoruc/ml-collection/blob/main/ml-from-scratch/logistic_regression.py"
  click MLP1 "https://github.com/ayhanoruc/ml-collection/blob/main/dl-from-scratch/mlp/auto_tensor.py"
  click MLP2 "https://github.com/ayhanoruc/ml-collection/blob/main/dl-from-scratch/mlp/neural_structures.py"
  click MLP3 "https://github.com/ayhanoruc/ml-collection/blob/main/dl-from-scratch/mlp/trainer.py"
  click MLP4 "https://github.com/ayhanoruc/ml-collection/blob/main/dl-from-scratch/mlp/classification_demo.py"
  click MLP5 "https://github.com/ayhanoruc/ml-collection/blob/main/dl-from-scratch/mlp/snippets.ipynb"
  click CNN1 "https://github.com/ayhanoruc/ml-collection/blob/main/dl-from-scratch/cnn/utils.py"
  click CNN2 "https://github.com/ayhanoruc/ml-collection/blob/main/dl-from-scratch/cnn/backprop.ipynb"
  click CNN3 "https://github.com/ayhanoruc/ml-collection/blob/main/dl-from-scratch/cnn/custom_,dataset_and_dataloaders.ipynb"
  click CNN4 "https://github.com/ayhanoruc/ml-collection/blob/main/dl-from-scratch/cnn/manuel_conv.ipynb"
  click CNN5 "https://github.com/ayhanoruc/ml-collection/blob/main/dl-from-scratch/cnn/modern_architectures.ipynb"
  click CNN6 "https://github.com/ayhanoruc/ml-collection/blob/main/dl-from-scratch/cnn/pooling_and_flattening.ipynb"
  click CNN7 "https://github.com/ayhanoruc/ml-collection/blob/main/dl-from-scratch/cnn/predefined_kernels.ipynb"
  click CNN8 "https://github.com/ayhanoruc/ml-collection/blob/main/dl-from-scratch/cnn/training_and_validating.ipynb"
  click R1 "https://github.com/ayhanoruc/ml-collection/blob/main/genai-from-scratch/rnn/dataset.py"
  click R2 "https://github.com/ayhanoruc/ml-collection/blob/main/genai-from-scratch/rnn/generic_RNN.ipynb"
  click R3 "https://github.com/ayhanoruc/ml-collection/blob/main/genai-from-scratch/rnn/char_level_rnn.ipynb"
  click R4 "https://github.com/ayhanoruc/ml-collection/blob/main/genai-from-scratch/rnn/many_to_one_rnn.ipynb"
  click R5 "https://github.com/ayhanoruc/ml-collection/blob/main/genai-from-scratch/rnn/rnn_on_timseries.ipynb"
  click R6 "https://github.com/ayhanoruc/ml-collection/blob/main/genai-from-scratch/rnn/rnn_w_tf.ipynb"
  click R7 "https://github.com/ayhanoruc/ml-collection/blob/main/genai-from-scratch/rnn/rnn_w_torch.ipynb"
  click L1 "https://github.com/ayhanoruc/ml-collection/blob/main/genai-from-scratch/lstm/lstm.ipynb"
  click L2 "https://github.com/ayhanoruc/ml-collection/blob/main/genai-from-scratch/lstm/gru.ipynb"

  %% Styles
  classDef data fill:#bbdefb,stroke:#1e88e5,color:#0d47a1
  classDef compute fill:#c8e6c9,stroke:#43a047,color:#1b5e20
  classDef presentation fill:#ffe0b2,stroke:#fb8c00,color:#e65100
  classDef extension fill:#f3e5f5,stroke:#8e24aa,color:#4a148c,stroke-dasharray: 5 5
  class Extension extension
```
