# jeankossaifi/fista architecture

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

- Interactive diagram: https://gitdiagram.com/jeankossaifi/fista
- Repository: https://github.com/jeankossaifi/fista

## Overview

##### Project type and purpose
- This is a thin Python library (package) implementing the Fast Iterative Shrinkage/Thresholding Algorithm (FISTA), together with supporting modules for data generation, cross‐validation, an example script, and unit tests.
- It is not a web app or microservice—its purpose is to expose FISTA (and related utilities) as a reusable library for numerical optimization in Python scripts.

##### File structure
- Top-level files:
- __init__.py        – package entry point
- fista.py           – core algorithm implementation
- cross_val.py       – routines to run FISTA under cross-validation
- datasets.py        – data‐loading utilities
- simulated_data.py  – synthetic data generators
- example_iris.py    – demo script showing FISTA on the Iris dataset
- README.md
- tests/
- test_fista.py      – unit tests for the core fista.py module
- No sub‐packages for “frontend” or “backend”; the architecture is purely functional/modular.

##### README for additional insights
- The README confirms this is a “Fast version of ISTA.”

- Core Algorithm Module
– fista.py
- Data Utilities
– datasets.py
– simulated_data.py
- Evaluation / CV Module
– cross_val.py
- Example Application
– example_iris.py
- Test Suite
– tests/test_fista.py
- Package Interface
– __init__.py (exposes fista and utility functions)
- External Dependencies (in a separate “stack” corner)
– NumPy, SciPy, scikit‐learn (for example_iris), pytest/unittest

- example_iris.py → imports → {fista.py, datasets.py, cross_val.py}
- cross_val.py → imports → fista.py
- cross_val.py → imports → datasets.py / simulated_data.py
- tests/test_fista.py → imports → fista.py
- __init__.py → imports & re-exports → {fista.py, cross_val.py, datasets.py, simulated_data.py}
- All modules → import → NumPy / SciPy (external)
- example_iris.py → import → scikit‐learn datasets (external)

c. Architectural patterns / design principles
- Modularity – each file encapsulates one concern (algorithm, data, validation, example, tests).
- Separation of concerns – core numerics (fista.py) is isolated from I/O or data‐generation code.
- Test coverage – a dedicated test module ensures correctness.
- Example as “consumer” – the example script demonstrates how consumer code uses the library.

d. Relevant technologies / frameworks
- Python 3
- NumPy / SciPy – array operations, linear algebra
- scikit-learn – (only in example_iris.py) for loading the Iris data
- pytest or unittest – for test execution

- Core Algorithm (e.g., red rectangle)
- Utilities (e.g., blue rectangles)
- Evaluation/CV (e.g., orange)
- Example App (e.g., green)
- Tests (e.g., gray)

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "FISTA Package"
        init["__init__.py"]:::entrypoint
        core["fista.py"]:::core
        data1["datasets.py"]:::util
        data2["simulated_data.py"]:::util
        cv["cross_val.py"]:::cv
    end

    example["example_iris.py"]:::example
    testpkg["tests/__init__.py"]:::test
    test["tests/test_fista.py"]:::test
    doc["README.md"]:::doc

    subgraph "External Libraries"
        np["NumPy"]:::external
        scipy["SciPy"]:::external
        sk["scikit-learn"]:::external
        pytest["pytest"]:::external
    end

    data1 -->|"imports"| core
    data2 -->|"imports"| core

    core -->|"imports"| cv
    data1 -->|"imports"| cv
    data2 -->|"imports"| cv

    core -->|"imports"| example
    cv -->|"imports"| example
    data1 -->|"imports"| example

    core -->|"imports"| test
    testpkg -->|"contains"| test

    init -->|"re-exports"| core
    init -->|"re-exports"| data1
    init -->|"re-exports"| data2
    init -->|"re-exports"| cv

    example -->|"imports"| sk

    core -->|"imports"| np
    data1 -->|"imports"| np
    data2 -->|"imports"| np
    cv -->|"imports"| np

    core -->|"imports"| scipy
    data1 -->|"imports"| scipy
    data2 -->|"imports"| scipy
    cv -->|"imports"| scipy

    test -->|"runs on"| pytest

    click core "https://github.com/jeankossaifi/fista/blob/master/fista.py"
    click data1 "https://github.com/jeankossaifi/fista/blob/master/datasets.py"
    click data2 "https://github.com/jeankossaifi/fista/blob/master/simulated_data.py"
    click cv "https://github.com/jeankossaifi/fista/blob/master/cross_val.py"
    click example "https://github.com/jeankossaifi/fista/blob/master/example_iris.py"
    click init "https://github.com/jeankossaifi/fista/blob/master/__init__.py"
    click test "https://github.com/jeankossaifi/fista/blob/master/tests/test_fista.py"
    click testpkg "https://github.com/jeankossaifi/fista/blob/master/tests/__init__.py"
    click doc "https://github.com/jeankossaifi/fista/blob/master/README.md"

    subgraph "Legend"
        Lcore["Core Algorithm"]:::core
        Lutil["Data Utilities"]:::util
        Lcv["CV Module"]:::cv
        Lexample["Example App"]:::example
        Ltest["Test Suite"]:::test
        Lentry["Package Interface"]:::entrypoint
        Ldoc["Documentation"]:::doc
        Lexternal["External Libraries"]:::external
    end

    classDef core fill:#f88,stroke:#800
    classDef util fill:#8bf,stroke:#059
    classDef cv fill:#f8b,stroke:#f80
    classDef example fill:#8f8,stroke:#080
    classDef test fill:#ccc,stroke:#666
    classDef entrypoint fill:#ff8,stroke:#fc0
    classDef external fill:#fff,stroke:#999,stroke-dasharray: 5 5
    classDef doc fill:#ffc,stroke:#cc9
```
