# maneeshks/homemade-machine-learning architecture

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

- Interactive diagram: https://gitdiagram.com/maneeshks/homemade-machine-learning
- Repository: https://github.com/maneeshks/homemade-machine-learning

## Overview

##### Project type and purpose
- This is an open-source educational library of homemade machine learning algorithms with interactive Jupyter Notebook demos.
- It is not a user-facing “application” but rather a code library + demo suite intended to teach and illustrate core ML algorithms in Python.

##### File structure
- Top-level directories:
- data/   – CSV datasets used by demos
- homemade/ – Python package implementing algorithms (subpackages: linear_regression, logistic_regression, k_means, anomaly_detection, neural_network, utils)
- notebooks/ – Jupyter Notebook demos that import from homemade/ and data/
- Configuration: requirements.txt, pylintrc, .travis.yml, GitHub metadata (CONTRIBUTING, CODE_OF_CONDUCT, LICENSE)

##### README for insights
- Purpose: show math behind each algorithm by implementing from scratch
- Integration points: Jupyter NBViewer for static demos, Binder for runnable environments, Travis CI for continuous integration

##### Detail is critical
- Utils/features and utils/hypothesis submodules as inputs to algorithm modules
- Explicitly show notebooks grouped by algorithm area pointing back at the modules they import
- Config files and CI pipeline as part of the maintenance/quality assurance component

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Repository and Services
    Repo["GitHub Repository"]:::code
    CI["Travis CI"]:::cloud
    Binder["Binder"]:::cloud
    NBViewer["NBViewer"]:::cloud

    Repo -->|"push & PR triggers"| CI
    Repo -->|"launch live demo"| Binder
    Repo -->|"serve static demo"| NBViewer

    CI -->|"runs lint & tests"| Lint["Linting (pylintrc)"]:::code
    CI -->|"validates notebooks"| TestNB["Notebook Validation"]:::code

    Binder -->|"spins up Jupyter"| DevEnv
    NBViewer -->|"renders notebooks"| NotebooksGroup

    %% Developer Environment & Dependency Manager
    DevEnv["Developer Environment\n(Python + virtualenv)"]:::cloud
    DepMgr["Dependency Manager\n(requirements.txt)"]:::code
    DevEnv -->|"installs deps"| DepMgr

    click DepMgr "https://github.com/maneeshks/homemade-machine-learning/blob/master/requirements.txt"

    %% Algorithm Library
    subgraph "Algorithm Library"  
        direction TB
        subgraph "Linear Regression"
            LRmod["linear_regression.py"]:::code
        end
        subgraph "Logistic Regression"
            Logmod["logistic_regression.py"]:::code
        end
        subgraph "K-Means Clustering"
            KMod["k_means.py"]:::code
        end
        subgraph "Anomaly Detection"
            AMod["gaussian_anomaly_detection.py"]:::code
        end
        subgraph "Neural Network (MLP)"
            NNmod["multilayer_perceptron.py"]:::code
        end
    end

    click LRmod "https://github.com/maneeshks/homemade-machine-learning/blob/master/homemade/linear_regression/linear_regression.py"
    click Logmod "https://github.com/maneeshks/homemade-machine-learning/blob/master/homemade/logistic_regression/logistic_regression.py"
    click KMod "https://github.com/maneeshks/homemade-machine-learning/blob/master/homemade/k_means/k_means.py"
    click AMod "https://github.com/maneeshks/homemade-machine-learning/blob/master/homemade/anomaly_detection/gaussian_anomaly_detection.py"
    click NNmod "https://github.com/maneeshks/homemade-machine-learning/blob/master/homemade/neural_network/multilayer_perceptron.py"

    %% Utilities Layer
    subgraph "Utilities Layer"
        direction TB
        subgraph "Feature Generation & Processing"
            Poly["generate_polynomials.py"]:::code
            Sin["generate_sinusoids.py"]:::code
            Norm["normalize.py"]:::code
            Prep["prepare_for_training.py"]:::code
        end
        subgraph "Hypothesis Functions"
            Sig["sigmoid.py"]:::code
            Grad["sigmoid_gradient.py"]:::code
        end
    end

    click Poly "https://github.com/maneeshks/homemade-machine-learning/blob/master/homemade/utils/features/generate_polynomials.py"
    click Sin "https://github.com/maneeshks/homemade-machine-learning/blob/master/homemade/utils/features/generate_sinusoids.py"
    click Norm "https://github.com/maneeshks/homemade-machine-learning/blob/master/homemade/utils/features/normalize.py"
    click Prep "https://github.com/maneeshks/homemade-machine-learning/blob/master/homemade/utils/features/prepare_for_training.py"
    click Sig "https://github.com/maneeshks/homemade-machine-learning/blob/master/homemade/utils/hypothesis/sigmoid.py"
    click Grad "https://github.com/maneeshks/homemade-machine-learning/blob/master/homemade/utils/hypothesis/sigmoid_gradient.py"

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        Data["CSV Datasets (data/)"]:::data
    end

    click Data "https://github.com/maneeshks/homemade-machine-learning/tree/master/data/"

    %% Demo Layer - Notebooks
    subgraph "Demo Layer (Notebooks)"
        direction TB
        NB_LR["notebooks/linear_regression/"]:::notebooks
        NB_Log["notebooks/logistic_regression/"]:::notebooks
        NB_K["notebooks/k_means/"]:::notebooks
        NB_A["notebooks/anomaly_detection/"]:::notebooks
        NB_NN["notebooks/neural_network/"]:::notebooks
    end

    click NB_LR "https://github.com/maneeshks/homemade-machine-learning/tree/master/notebooks/linear_regression/"
    click NB_Log "https://github.com/maneeshks/homemade-machine-learning/tree/master/notebooks/logistic_regression/"
    click NB_K "https://github.com/maneeshks/homemade-machine-learning/tree/master/notebooks/k_means/"
    click NB_A "https://github.com/maneeshks/homemade-machine-learning/tree/master/notebooks/anomaly_detection/"
    click NB_NN "https://github.com/maneeshks/homemade-machine-learning/tree/master/notebooks/neural_network/"

    %% Visualization & Documentation
    subgraph "Visualization & Docs"
        direction TB
        Images["Static Diagrams (images/)"]:::data
    end

    click Images "https://github.com/maneeshks/homemade-machine-learning/tree/master/images/"

    %% Connections
    DepMgr -->|"provides libs"| Repo
    Repo -->|"hosts code"| AlgLibrary
    Repo -->|"hosts code"| UtilitiesLayer
    Data -->|"feeds"| NotebooksGroup
    AlgLibrary -->|"imported by"| NotebooksGroup
    UtilitiesLayer -->|"imported by"| AlgLibrary
    NotebooksGroup -->|"embed outputs"| Images

    %% Group aliases
    subgraph _AlgLibAlias
        AlgLibrary
    end
    subgraph _UtilsAlias
        UtilitiesLayer
    end
    subgraph _NBGroupAlias
        NotebooksGroup
    end

    %% Styles
    classDef code fill:#D6E9FF,stroke:#333,stroke-width:1px
    classDef data fill:#D6FFD6,stroke:#333,stroke-width:1px
    classDef notebooks fill:#FFF5B1,stroke:#333,stroke-width:1px
    classDef cloud fill:#E0E0E0,stroke:#333,stroke-width:1px
```
