# ebsz/srsnn architecture

> Architecture diagram of the GitHub repository ebsz/srsnn, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ebsz/srsnn
- Repository: https://github.com/ebsz/srsnn

## Overview

Main Components to Include:

##### Core Model Layer
- Subcomponents:
- Neuron Models (Izhikevich, Lapicque)
- Synapse Models (Basic, Exponential, Bi-exponential)
- Network Representation
- Spike Processing

##### Connection Set Algebra (CSA) Layer
- This adjacent to the Core Model Layer
- How it interfaces with the network representation
- Mask and operation components

##### Evolution Framework
- This as a top-level component
- Subcomponents:
- NES (Natural Evolution Strategy)
- SNES (Separable Natural Evolution Strategy)
- Statistics Collection

##### Tasks Framework
- This as a separate module
- Various task implementations:
- XOR Task
- MNIST Task
- Pole Balancing
- Pattern Recognition
- Time Series
- Lorenz Task

##### Utility Layer
- This as a supporting layer
- Include:
- Analysis Tools
- Configuration Management
- Data Handling
- Mathematical Utilities
- Random Number Generation

##### Hierarchical Structure
- Core components at the center
- Supporting modules arranged around the core
- Clear separation between different functional areas

##### Related Components
- Cluster neuron models together
- Synapse implementations
- Task implementations in a grid

##### Flow Direction
- Evolution/optimization flow from top to bottom
- Task execution flow from left to right
- Utility access from the periphery

Special Considerations:

##### Stochastic Nature
- Random number generation components
- Probability distribution flows
- Stochastic processes in the evolution framework

##### Mathematical Integration
- CSA formalism interfaces
- Mathematical utility connections
- Where optimization algorithms integrate

##### Monitoring and Analysis
- Analysis pipelines
- Where statistics are collected
- Logging points

- Version information
- External dependencies
- Document key mathematical formulas or algorithms

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef core fill:#a8d1f0,stroke:#333
    classDef evolution fill:#90EE90,stroke:#333
    classDef task fill:#FFE5B4,stroke:#333
    classDef utility fill:#E6E6E6,stroke:#333
    classDef csa fill:#DDA0DD,stroke:#333

    %% Core Model Layer
    subgraph CoreModel["Core Model Layer"]
        NeuronModels["Neuron Models"]
        SynapseModels["Synapse Models"]
        NetworkRep["Network Representation"]
        SpikeProc["Spike Processing"]

        %% Neuron Model Implementations
        Izhikevich["Izhikevich Model"]
        Lapicque["Lapicque Model"]
        NeuronModels --> Izhikevich
        NeuronModels --> Lapicque

        %% Synapse Model Implementations
        BasicSyn["Basic Synapse"]
        ExpSyn["Exponential Synapse"]
        BiExpSyn["Bi-exponential Synapse"]
        SynapseModels --> BasicSyn
        SynapseModels --> ExpSyn
        SynapseModels --> BiExpSyn
    end

    %% CSA Layer
    subgraph CSA["Connection Set Algebra"]
        CSAMask["Mask Component"]
        CSAOp["Operations Component"]
    end

    %% Evolution Framework
    subgraph Evolution["Evolution Framework"]
        NES["Natural Evolution Strategy"]
        SNES["Separable NES"]
        Stats["Statistics Collection"]
    end

    %% Tasks Framework
    subgraph Tasks["Tasks Framework"]
        TaskRunner["Task Runner"]
        XORTask["XOR Task"]
        MNISTTask["MNIST Task"]
        PoleTask["Pole Balancing"]
        PatternTask["Pattern Recognition"]
        TimeSeriesTask["Time Series"]
        LorenzTask["Lorenz Task"]
    end

    %% Utility Layer
    subgraph Utils["Utility Layer"]
        Analysis["Analysis Tools"]
        Config["Configuration Management"]
        DataHandler["Data Handling"]
        MathUtils["Mathematical Utilities"]
        RNG["Random Number Generation"]
        Params["Parameter Management"]
        Logger["Logging"]
    end

    %% Connections
    CoreModel -.-> CSA
    Evolution --> CoreModel
    Tasks --> CoreModel
    Utils --> CoreModel
    Utils --> Evolution
    Utils --> Tasks
    CSA --> NetworkRep
    TaskRunner --> XORTask
    TaskRunner --> MNISTTask
    TaskRunner --> PoleTask
    TaskRunner --> PatternTask
    TaskRunner --> TimeSeriesTask
    TaskRunner --> LorenzTask

    %% Click Events
    click NeuronModels "https://github.com/ebsz/srsnn/tree/master/model/src/neuron/"
    click Izhikevich "https://github.com/ebsz/srsnn/blob/master/model/src/neuron/izhikevich.rs"
    click Lapicque "https://github.com/ebsz/srsnn/blob/master/model/src/neuron/lapicque.rs"
    click SynapseModels "https://github.com/ebsz/srsnn/tree/master/model/src/synapse/"
    click BasicSyn "https://github.com/ebsz/srsnn/blob/master/model/src/synapse/basic.rs"
    click ExpSyn "https://github.com/ebsz/srsnn/blob/master/model/src/synapse/exponential.rs"
    click BiExpSyn "https://github.com/ebsz/srsnn/blob/master/model/src/synapse/bi_exponential.rs"
    click NetworkRep "https://github.com/ebsz/srsnn/blob/master/model/src/network/representation.rs"
    click SpikeProc "https://github.com/ebsz/srsnn/blob/master/model/src/spikes.rs"
    click CSAMask "https://github.com/ebsz/srsnn/blob/master/csa/src/mask.rs"
    click CSAOp "https://github.com/ebsz/srsnn/blob/master/csa/src/op.rs"
    click NES "https://github.com/ebsz/srsnn/blob/master/evolution/src/algorithm/nes.rs"
    click SNES "https://github.com/ebsz/srsnn/blob/master/evolution/src/algorithm/snes.rs"
    click Stats "https://github.com/ebsz/srsnn/blob/master/evolution/src/stats.rs"
    click XORTask "https://github.com/ebsz/srsnn/blob/master/tasks/src/xor_task.rs"
    click MNISTTask "https://github.com/ebsz/srsnn/blob/master/tasks/src/mnist_task.rs"
    click PoleTask "https://github.com/ebsz/srsnn/blob/master/tasks/src/pole_balancing_task.rs"
    click PatternTask "https://github.com/ebsz/srsnn/blob/master/tasks/src/pattern.rs"
    click TimeSeriesTask "https://github.com/ebsz/srsnn/blob/master/tasks/src/time_series.rs"
    click LorenzTask "https://github.com/ebsz/srsnn/blob/master/tasks/src/lorenz_task.rs"
    click TaskRunner "https://github.com/ebsz/srsnn/blob/master/tasks/src/task_runner.rs"
    click Analysis "https://github.com/ebsz/srsnn/blob/master/utils/src/analysis.rs"
    click Config "https://github.com/ebsz/srsnn/blob/master/utils/src/config.rs"
    click DataHandler "https://github.com/ebsz/srsnn/blob/master/utils/src/data.rs"
    click MathUtils "https://github.com/ebsz/srsnn/blob/master/utils/src/math.rs"
    click RNG "https://github.com/ebsz/srsnn/blob/master/utils/src/random.rs"
    click Params "https://github.com/ebsz/srsnn/blob/master/utils/src/parameters.rs"
    click Logger "https://github.com/ebsz/srsnn/blob/master/utils/src/logger.rs"

    %% Apply Classes
    class CoreModel,NeuronModels,SynapseModels,NetworkRep,SpikeProc,Izhikevich,Lapicque,BasicSyn,ExpSyn,BiExpSyn core
    class Evolution,NES,SNES,Stats evolution
    class Tasks,TaskRunner,XORTask,MNISTTask,PoleTask,PatternTask,TimeSeriesTask,LorenzTask task
    class Utils,Analysis,Config,DataHandler,MathUtils,RNG,Params,Logger utility
    class CSA,CSAMask,CSAOp csa
```
