# ecrl/ecnet architecture

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

- Interactive diagram: https://gitdiagram.com/ecrl/ecnet
- Repository: https://github.com/ecrl/ecnet

## Overview

##### Main Components

a. Core Components:
- Data Processing Layer
- Model Layer
- Blending Layer
- Task Management Layer

b. External Dependencies:
- PyTorch (ML Framework)
- QSPR Descriptor Generators (PaDEL-Descriptor, alvaDesc)
- Data Sources (SMILES files, target property files)

##### Component Relationships and Structure

**┌─ External Data Sources ─┐**
- SMILES Files         │
- Target Property Files│
- ┬─────────────┘
- ↓
**┌─ Data Processing Layer ───────┐**
- Dataset Loading            │
- QSPR Descriptor Generation │
- Data Structuring           │
- ┬──────────────────┘
- ↓
**┌─ Model Layer ───────────────┐**
- PyTorch Neural Networks   │
- Model Training           │
- Prediction Pipeline      │
- ┬────────────────┘
- ↓
**┌─ Blending Layer ──────────┐**
- Equation Processing     │
- Prediction Blending     │
- ┬───────────────┘
- ↓
**┌─ Task Management Layer ────┐**
- Feature Selection       │
- Parameter Tuning        │
- ┘

##### Specific Implementation Details

a. Data Flow:
- How SMILES files and target properties flow through the system
- Where QSPR descriptors are generated and integrated
- Demonstrate the path from raw data to predictions

b. Key Modules (based on file structure):
- datasets/ (data loading and processing)
- model.py (core ML functionality)
- blends/ (prediction combining)
- tasks/ (optimization and tuning)

c. Integration Points:
- PyTorch integration
- QSPR generator connection points
- Callback hooks

##### Implementation Notes

- The modular nature of the system
- The clear separation of concerns between layers
- The extensibility of the architecture
- The data flow from input to prediction

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Data Sources
    subgraph Data_Sources
        SMILES["SMILES Files"]
        TPF["Target Property Files"]
    end
    click SMILES "https://github.com/ecrl/ecnet/blob/master/ecnet/datasets/data/*.smiles"
    click TPF "https://github.com/ecrl/ecnet/blob/master/ecnet/datasets/data/*.target"

    %% Data Processing Layer
    subgraph DataProcessing
        DL["Dataset Loading"]:::data
        QSPR["QSPR Descriptor Generation"]:::data
        DS["Data Structuring"]:::data
    end
    click DataProcessing "https://github.com/ecrl/ecnet/tree/master/ecnet/datasets/"
    click DL "https://github.com/ecrl/ecnet/blob/master/ecnet/datasets/load_data.py"
    click DS "https://github.com/ecrl/ecnet/blob/master/ecnet/datasets/structs.py"

    %% Model Layer
    subgraph ModelLayer
        NN["PyTorch Neural Networks"]:::model
        MT["Model Training"]:::model
        PP["Prediction Pipeline"]:::model
    end
    click ModelLayer "https://github.com/ecrl/ecnet/blob/master/ecnet/model.py"

    %% Blending Layer
    subgraph BlendingLayer
        EP["Equation Processing"]:::blend
        PB["Prediction Blending"]:::blend
    end
    click BlendingLayer "https://github.com/ecrl/ecnet/tree/master/ecnet/blends/"
    click EP "https://github.com/ecrl/ecnet/blob/master/ecnet/blends/equations.py"
    click PB "https://github.com/ecrl/ecnet/blob/master/ecnet/blends/predict.py"

    %% Task Management Layer
    subgraph TaskManagement
        FS["Feature Selection"]:::task
        PT["Parameter Tuning"]:::task
    end
    click TaskManagement "https://github.com/ecrl/ecnet/tree/master/ecnet/tasks/"
    click FS "https://github.com/ecrl/ecnet/blob/master/ecnet/tasks/feature_selection.py"
    click PT "https://github.com/ecrl/ecnet/blob/master/ecnet/tasks/parameter_tuning.py"

    %% External Dependencies
    subgraph Dependencies
        PyTorch["PyTorch"]:::external
        PaDEL["PaDEL-Descriptor"]:::external
        AlvaDesc["alvaDesc"]:::external
    end

    %% Callbacks
    CB["Callback System"]:::system
    click CB "https://github.com/ecrl/ecnet/blob/master/ecnet/callbacks.py"

    %% Connections
    SMILES --> DL
    TPF --> DL
    DL --> QSPR
    QSPR --> DS
    DS --> NN
    NN --> MT
    MT --> PP
    PP --> EP
    EP --> PB
    PB --> FS
    PB --> PT
    PyTorch --> NN
    PaDEL --> QSPR
    AlvaDesc --> QSPR
    CB --> MT

    %% Styles
    classDef data fill:#3498db,stroke:#2980b9,color:white
    classDef model fill:#2ecc71,stroke:#27ae60,color:white
    classDef blend fill:#e67e22,stroke:#d35400,color:white
    classDef task fill:#9b59b6,stroke:#8e44ad,color:white
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef system fill:#34495e,stroke:#2c3e50,color:white

    %% Legend
    subgraph Legend
        L1["Data Processing"]:::data
        L2["Model Components"]:::model
        L3["Blending Components"]:::blend
        L4["Task Management"]:::task
        L5["External Dependencies"]:::external
        L6["System Components"]:::system
    end
```
