# frankl1/sast architecture

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

- Interactive diagram: https://gitdiagram.com/frankl1/sast
- Repository: https://github.com/frankl1/sast

## Overview

##### Main Components
- Core Algorithm Module:
- Centralized SAST implementation contained in the "sast" directory (e.g., sast.py for the core SAST algorithm, stck.py for STC variants).
- Utility functions (utils.py) that support common operations.
- Experiment Scripts:
- Consolidate all experiment files under the "experiment-scripts" folder. Each script (such as experiment-sast-approx.py, experiment-sast-ensemble-full.py, etc.) demonstrates different aspects or variations of the shapelet-based approaches.
- That these scripts include benchmarking experiments (accuracy comparisons, scalability tests) that feed data into the classifiers and produce CSV results.
- Data & Result Handling:
- "results" directory as the sink where outcomes of experiments are stored in CSV formats.
- Notebook & Documentation:
- The “sast.ipynb” Jupyter notebook acts as an interface or tutorial demonstrating usage.
- The README provides contextual explanation, sample code, and dependency requirements.

##### Relationships and Interactions
- That these modules rely on utility functions (e.g., from utils.py) for data processing and common computational tasks.
- Specify the flow: Input Data → Preprocessing → Core Algorithm (SAST/STC) → Classifier Fitting/Predicting → Results Generation → Visualization (images, CSV output).

##### Architectural Patterns & Design Principles
- Modularity: separate directories for core algorithms versus experimental scripts and result visualization.
- An experimental/research workflow pattern: core module → experiment orchestration → data collection and visualization.
- Lay out dependency and integration relationships with external libraries (numpy, numba, scikit-learn, sktime) which support numerical computations and model building.

##### Technologies and Frameworks
- Usage of Python and core numerical libraries (numpy, numba) and ML tools (scikit-learn).
- Optionally mention the integration with the Aeon toolkit as per the README links, indicating that SAST has been incorporated or referenced via that broader ecosystem.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Core Algorithms"
        A["SAST Core: Implements SAST algorithm"]:::core
        B["STC Variants: Implements STC-k algorithms"]:::core
        C["Utilities: Common operations & data processing"]:::utility
        A -->|"uses"| C
        B -->|"uses"| C
        subgraph "Diagnostic Tools"
            D["mass2: Performance Diagnostics"]:::diagnostic
            E["CD Diagram: Dependency Analysis"]:::diagnostic
        end
        A -->|"diagnostics"| D
        A -->|"diagnostics"| E
    end

    subgraph "Experimentation & Research"
        G["Interactive Tutorial: Jupyter Notebook"]:::tutorial
        F["Experiment Scripts: Orchestrate experiments"]:::experiment
    end

    subgraph "Output & Visualization"
        H["Results Storage: CSV outputs"]:::result
        I["Visualization Materials: Plots and Diagrams"]:::result
    end

    G -->|"triggers"| F
    F -->|"invokes"| A
    F -->|"invokes"| B
    F -->|"logs"| H
    H -->|"feeds"| I

    classDef core fill:#a1c4fd,stroke:#333,stroke-width:2px;
    classDef utility fill:#fffd82,stroke:#333,stroke-width:2px;
    classDef diagnostic fill:#f8b195,stroke:#333,stroke-width:2px;
    classDef experiment fill:#c3f0ca,stroke:#333,stroke-width:2px;
    classDef result fill:#ffd3b6,stroke:#333,stroke-width:2px;
    classDef tutorial fill:#d3d3e4,stroke:#333,stroke-width:2px;

    click A "https://github.com/frankl1/sast/blob/main/sast/sast.py"
    click B "https://github.com/frankl1/sast/blob/main/sast/stck.py"
    click C "https://github.com/frankl1/sast/blob/main/sast/utils.py"
    click D "https://github.com/frankl1/sast/blob/main/sast/mass2.py"
    click E "https://github.com/frankl1/sast/blob/main/sast/cd_diagram.py"
    click F "https://github.com/frankl1/sast/tree/main/experiment-scripts/"
    click H "https://github.com/frankl1/sast/tree/main/results/"
    click I "https://github.com/frankl1/sast/tree/main/images/"
    click G "https://github.com/frankl1/sast/blob/main/sast.ipynb"
```
