# samarthpardhi/mixture-models architecture

> Architecture diagram of the GitHub repository samarthpardhi/mixture-models, 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/samarthpardhi/mixture-models
- Repository: https://github.com/samarthpardhi/mixture-models

## Overview

##### Project type and purpose
- This is an open-source, Python-based mixture-model library and command-line toolset for heterogeneous data clustering (Gaussian, categorical, hybrid) with feature-selection, accompanied by Jupyter notebook examples.

##### File structure
- Top level:
- mixtureModels.py – core EM-based model classes
- learn_*.py & learn_scikit_gmm.py – CLI entry points for each model
- utils.py, plotting.py, cluster_stats_new.py, evaluate.py – helper modules for data I/O, visualization, and evaluation
- exampleOut, outCat, outGauss, outScikitGMM – directories capturing model outputs
- examples/ – Jupyter notebooks demonstrating usage and results
- No external build or deployment scripts—this is a library/tool with CLI and notebook interfaces.

##### README for additional insights
- Confirms the core models (general-covariance GMM, diagonal GMM, categorical, hybrid)
- Highlights command-line arguments, dependencies (NumPy, SciPy, scikit-learn, Matplotlib, seaborn)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User Interfaces Layer
    subgraph "User Interfaces"
        subgraph CLI
            learn_cat["learn_cat.py"]:::ui
            learn_cat_fs["learn_cat_fs.py"]:::ui
            learn_cat_gauss_diag["learn_cat_gauss_diag.py"]:::ui
            learn_diagonal_gauss["learn_diagonal_gauss.py"]:::ui
            learn_diagonal_gauss_fs["learn_diagonal_gauss_fs.py"]:::ui
            learn_general_gauss["learn_general_gauss.py"]:::ui
            learn_scikit_gmm["learn_scikit_gmm.py"]:::ui
            evaluate["evaluate.py"]:::ui
        end
        subgraph Notebooks
            nb1["gaussMM-HyperParametersData-FS-2D.ipynb"]:::ui
            nb2["gaussMM-HyperParametersData-FS.ipynb"]:::ui
            nb3["thesis-result-Cat-with-noise.ipynb"]:::ui
            nb4["thesis-result-CatGauss-with-noise.ipynb"]:::ui
            nb5["thesis-result-Gauss-with-noise.ipynb"]:::ui
            nb6["thesis-result-real-data.ipynb"]:::ui
        end
    end

    %% Core & Utility Modules Layer
    subgraph "Core & Utilities"
        core["mixtureModels.py"]:::core
        utils["utils.py"]:::core
        viz["plotting.py"]:::core
        stats["cluster_stats_new.py"]:::core
    end

    %% Data Stores Layer
    subgraph "Data Stores"
        input_files["Input Files (.csv, .txt)"]:::data
        exampleOut["exampleOut/"]:::data
        outCat["outCat/"]:::data
        outGauss["outGauss/"]:::data
        outScikitGMM["outScikitGMM/"]:::data
    end

    %% Example Data Directories
    subgraph "Example Data"
        resCatData["examples/thesisResCatData/"]:::data
        resCatGaussData["examples/thesisResCatGaussData/"]:::data
        resData["examples/thesisResData/"]:::data
    end

    %% External Dependencies
    subgraph "External Dependencies"
        numpy["NumPy"]:::ext
        scipy["SciPy"]:::ext
        sklearn["scikit-learn"]:::ext
        mpl["Matplotlib"]:::ext
        sns["seaborn"]:::ext
    end

    %% Data and Control Flows
    input_files -->|"loads data"| utils
    resCatData -->|"example input"| nb1
    resCatData -->|"example input"| nb2
    resCatData -->|"example input"| nb3
    resCatGaussData -->|"example input"| nb4
    resCatGaussData -->|"example input"| nb5
    resData -->|"example input"| nb6

    learn_cat -->|"calls I/O"| utils
    learn_cat_fs -->|"calls I/O"| utils
    learn_cat_gauss_diag -->|"calls I/O"| utils
    learn_diagonal_gauss -->|"calls I/O"| utils
    learn_diagonal_gauss_fs -->|"calls I/O"| utils
    learn_general_gauss -->|"calls I/O"| utils
    learn_scikit_gmm -->|"calls I/O"| utils
    evaluate -->|"calls I/O"| utils

    utils -->|"passes data"| core
    core -->|"EM algorithms"| stats
    stats -->|"computes metrics"| evaluate

    core -->|"generates results"| exampleOut
    core -->|"generates results"| outCat
    core -->|"generates results"| outGauss
    core -->|"generates results"| outScikitGMM

    viz -->|"plots data"| exampleOut
    viz -->|"plots data"| outCat
    viz -->|"plots data"| outGauss
    viz -->|"plots data"| outScikitGMM

    nb1 -->|"uses"| core
    nb1 -->|"uses"| viz
    nb2 -->|"uses"| core
    nb2 -->|"uses"| viz
    nb3 -->|"uses"| core
    nb3 -->|"uses"| viz
    nb4 -->|"uses"| core
    nb4 -->|"uses"| viz
    nb5 -->|"uses"| core
    nb5 -->|"uses"| viz
    nb6 -->|"uses"| core
    nb6 -->|"uses"| viz

    numpy -->|"utilizes"| core
    scipy -->|"utilizes"| core
    sklearn -->|"wraps"| core
    mpl -->|"utilizes"| viz
    sns -->|"utilizes"| viz

    %% Click Events
    click learn_cat "https://github.com/samarthpardhi/mixture-models/blob/main/learn_cat.py"
    click learn_cat_fs "https://github.com/samarthpardhi/mixture-models/blob/main/learn_cat_fs.py"
    click learn_cat_gauss_diag "https://github.com/samarthpardhi/mixture-models/blob/main/learn_cat_gauss_diag.py"
    click learn_diagonal_gauss "https://github.com/samarthpardhi/mixture-models/blob/main/learn_diagonal_gauss.py"
    click learn_diagonal_gauss_fs "https://github.com/samarthpardhi/mixture-models/blob/main/learn_diagonal_gauss_fs.py"
    click learn_general_gauss "https://github.com/samarthpardhi/mixture-models/blob/main/learn_general_gauss.py"
    click learn_scikit_gmm "https://github.com/samarthpardhi/mixture-models/blob/main/learn_scikit_gmm.py"
    click evaluate "https://github.com/samarthpardhi/mixture-models/blob/main/evaluate.py"
    click nb1 "https://github.com/samarthpardhi/mixture-models/blob/main/examples/gaussMM-HyperParametersData-FS-2D.ipynb"
    click nb2 "https://github.com/samarthpardhi/mixture-models/blob/main/examples/gaussMM-HyperParametersData-FS.ipynb"
    click nb3 "https://github.com/samarthpardhi/mixture-models/blob/main/examples/thesis-result-Cat-with-noise.ipynb"
    click nb4 "https://github.com/samarthpardhi/mixture-models/blob/main/examples/thesis-result-CatGauss-with-noise.ipynb"
    click nb5 "https://github.com/samarthpardhi/mixture-models/blob/main/examples/thesis-result-Gauss-with-noise.ipynb"
    click nb6 "https://github.com/samarthpardhi/mixture-models/blob/main/examples/thesis-result-real-data.ipynb"
    click core "https://github.com/samarthpardhi/mixture-models/blob/main/mixtureModels.py"
    click utils "https://github.com/samarthpardhi/mixture-models/blob/main/utils.py"
    click viz "https://github.com/samarthpardhi/mixture-models/blob/main/plotting.py"
    click stats "https://github.com/samarthpardhi/mixture-models/blob/main/cluster_stats_new.py"
    click exampleOut "https://github.com/samarthpardhi/mixture-models/tree/main/exampleOut/"
    click outCat "https://github.com/samarthpardhi/mixture-models/tree/main/outCat/"
    click outGauss "https://github.com/samarthpardhi/mixture-models/tree/main/outGauss/"
    click outScikitGMM "https://github.com/samarthpardhi/mixture-models/tree/main/outScikitGMM/"
    click resCatData "https://github.com/samarthpardhi/mixture-models/tree/main/examples/thesisResCatData/"
    click resCatGaussData "https://github.com/samarthpardhi/mixture-models/tree/main/examples/thesisResCatGaussData/"
    click resData "https://github.com/samarthpardhi/mixture-models/tree/main/examples/thesisResData/"

    %% Styles
    classDef ui fill:#D0E1F9,stroke:#0366d6,color:#0366d6
    classDef core fill:#C8E6C9,stroke:#2e7d32,color:#2e7d32
    classDef data fill:#ECEFF1,stroke:#546e7a,color:#37474f
    classDef ext fill:#FFE0B2,stroke:#ef6c00,color:#e65100
```
