# saigunaranjan/probability_and_machinelearning architecture

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

- Interactive diagram: https://gitdiagram.com/saigunaranjan/probability_and_machinelearning
- Repository: https://github.com/saigunaranjan/probability_and_machinelearning

## Overview

##### Project Type and Purpose
- This repo is a collection of standalone Python scripts and modules for probability-theory experiments and machine-learning exercises.
- There is no web front-end or microservice layer—rather it’s a modular, script-based toolkit.

##### File Structure
Top-level items:
- binary_classification.py, support_vector_machine.py, expectation_maximization_algo.py, buffonsNeedle.py, parabolicConstant.py
- ml_functions_lib.py (shared utility library)
- datasets/ (CSV files, e.g. Iris.csv)
- deep_neural_networks/ (five specialized NN scripts)
Notes:
– Each script imports from ml_functions_lib.py or directly loads datasets/*.
– No deployment scripts—these run locally as Python programs.

##### Extract Insights from the README
- The README confirms this is a “Probability_and_MachineLearning” toolkit for modelling and exercises.

##### Main Components & Their Relationships
a. Components:
1. Data Storage
– datasets/Iris.csv (and any CSVs you may add)
2. Shared Utilities
– ml_functions_lib.py
3. Probability‐Theory Scripts
– buffonsNeedle.py
– parabolicConstant.py
– expectation_maximization_algo.py
4. Classical ML Scripts
– binary_classification.py
– support_vector_machine.py
5. Deep Learning Suite
– deep_neural_networks/ (xor_gate.py, iris_data.py, multilayer_feedforward_nn.py, digit_recognition.py, disease_classification.py)
b. Interactions:
– All ML and probability scripts read from datasets/*.
– Scripts call into ml_functions_lib.py for common routines (e.g., matrix ops, activation functions).
– Deep neural scripts may also depend on external libs (NumPy, Pandas, TensorFlow/PyTorch) – annotate these as external services.
c. Architectural Patterns:
– Modular monolith: logically separated modules within one codebase.
– Reusable utility layer (ml_functions_lib) that prevents code duplication.
d. Technologies/Frameworks:
– Python 3.x
– Pandas/NumPy/Scikit-Learn/TensorFlow or PyTorch (as implied by deep_neural_networks)

##### Detailed Capturing of Architectural Elements
– Group scripts into three logical tiers: Probability, Classical ML, and Deep Learning.
– Place ml_functions_lib centrally as the shared utility layer.
– Annotate each group with bullets listing contained scripts.
– Note all external library dependencies off to one side to show environment requirements.

[Datasets (Iris.csv, …)] →
- buffonsNeedle.py
- parabolicConstant.py
- expectation_maximization_algo.py
- binary_classification.py
- support_vector_machine.py
- xor_gate.py
- iris_data.py
- multilayer_feedforward_nn.py
- digit_recognition.py
- disease_classification.py

→ [External Libraries: NumPy, Pandas, Scikit-Learn, TensorFlow/PyTorch]

– Blue for Data Store,
– Green for Probability,
– Yellow for ML,
– Orange for Deep Learning,
– Gray for Utilities,

- Highly detailed—every script/module is called out.
- Accurate—reflects actual code organization and dependencies.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Store
    DS["Datasets\n(Iris.csv, ...)"]:::data
    click DS "https://github.com/saigunaranjan/probability_and_machinelearning/blob/master/datasets/Iris.csv"

    %% Utility Layer
    Utils["ml_functions_lib.py"]:::utils
    click Utils "https://github.com/saigunaranjan/probability_and_machinelearning/blob/master/ml_functions_lib.py"

    %% External Dependencies
    Ext["External Libs\n(NumPy, Pandas,\nScikit-Learn,\nTensorFlow/PyTorch)"]:::external

    %% Probability Models
    subgraph "Probability Models"
        Buff["buffonsNeedle.py"]:::prob
        click Buff "https://github.com/saigunaranjan/probability_and_machinelearning/blob/master/buffonsNeedle.py"
        Parab["parabolicConstant.py"]:::prob
        click Parab "https://github.com/saigunaranjan/probability_and_machinelearning/blob/master/parabolicConstant.py"
        EM["expectation_maximization_algo.py"]:::prob
        click EM "https://github.com/saigunaranjan/probability_and_machinelearning/blob/master/expectation_maximization_algo.py"
    end

    %% Classical ML
    subgraph "Classical ML Algorithms"
        Binary["binary_classification.py"]:::ml
        click Binary "https://github.com/saigunaranjan/probability_and_machinelearning/blob/master/binary_classification.py"
        SVM["support_vector_machine.py"]:::ml
        click SVM "https://github.com/saigunaranjan/probability_and_machinelearning/blob/master/support_vector_machine.py"
    end

    %% Deep Neural Networks
    subgraph "Deep Neural Networks"
        XOR["xor_gate.py"]:::deep
        click XOR "https://github.com/saigunaranjan/probability_and_machinelearning/blob/master/deep_neural_networks/xor_gate.py"
        IrisNN["iris_data.py"]:::deep
        click IrisNN "https://github.com/saigunaranjan/probability_and_machinelearning/blob/master/deep_neural_networks/iris_data.py"
        MLFF["multilayer_feedforward_nn.py"]:::deep
        click MLFF "https://github.com/saigunaranjan/probability_and_machinelearning/blob/master/deep_neural_networks/multilayer_feedforward_nn.py"
        Digit["digit_recognition.py"]:::deep
        click Digit "https://github.com/saigunaranjan/probability_and_machinelearning/blob/master/deep_neural_networks/digit_recognition.py"
        Disease["disease_classification.py"]:::deep
        click Disease "https://github.com/saigunaranjan/probability_and_machinelearning/blob/master/deep_neural_networks/disease_classification.py"
    end

    %% Data Flow from Datasets to Scripts
    DS --> Buff
    DS --> Parab
    DS --> EM
    DS --> Binary
    DS --> SVM
    DS --> XOR
    DS --> IrisNN
    DS --> MLFF
    DS --> Digit
    DS --> Disease

    %% Scripts calling Utilities and External Libraries
    Buff -->|"uses"| Utils
    Parab -->|"uses"| Utils
    EM -->|"uses"| Utils
    Binary -->|"uses"| Utils
    SVM -->|"uses"| Utils
    XOR -->|"uses"| Utils
    IrisNN -->|"uses"| Utils
    MLFF -->|"uses"| Utils
    Digit -->|"uses"| Utils
    Disease -->|"uses"| Utils

    Buff -->|"import"| Ext
    Parab -->|"import"| Ext
    EM -->|"import"| Ext
    Binary -->|"import"| Ext
    SVM -->|"import"| Ext
    XOR -->|"import"| Ext
    IrisNN -->|"import"| Ext
    MLFF -->|"import"| Ext
    Digit -->|"import"| Ext
    Disease -->|"import"| Ext

    %% Style Definitions
    classDef data fill:#CCE5FF,stroke:#004085,stroke-width:1px;
    classDef prob fill:#D4EDDA,stroke:#155724,stroke-width:1px;
    classDef ml fill:#FFF3CD,stroke:#856404,stroke-width:1px;
    classDef deep fill:#FFE5B4,stroke:#E69500,stroke-width:1px;
    classDef utils fill:#E2E3E5,stroke:#6C757D,stroke-width:1px;
    classDef external fill:#F8D7DA,stroke:#721C24,stroke-width:1px,stroke-dasharray:5 5;
```
