# siba-p/ml_surfacepoly architecture

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

- Interactive diagram: https://gitdiagram.com/siba-p/ml_surfacepoly
- Repository: https://github.com/siba-p/ml_surfacepoly

## Overview

##### Project Type and Purpose
- This is a machine learning (ML) project aimed at predicting the Potential of Mean Force (PMF) profiles for polymer-surface interactions.
- The model leverages one-hot encoded representations and fractional compositions as input and is designed to replace computationally expensive umbrella sampling simulations.
- The key objectives include data preprocessing, transformation of raw simulation data into features, neural network training, and prediction output.

##### Analyzing the File Structure
- Data Layer:
- The “data” directory is split into “feature” and “target” subdirectories containing NumPy (.npy) files. These files represent the input features and the associated PMF profiles (targets), respectively.
- Preprocessing Scripts:
- The “scripts” folder holds preprocessing utilities (prepare_data.py and preprocessing.py)—these are responsible for data reshaping, and augmentation (for both polymer and surface data).
- Utility Functions:
- The “utils” directory contains ancillary helper functions (e.g., helper_function.py) that likely support data manipulation or common tasks.
- Configuration and Build:
- Files such as config.json, Makefile, and README.md indicate settings configuration, build routines, and documentation.
- Outputs:
- The “outputs” folder, along with the model_tested.pdf file, suggests that the project produces prediction results and evaluation reports.

a. Main Components:
- Data Sources: Represented by the two data directories (features and targets). Show these as file repositories holding the simulation data.
- Output / Evaluation: Represent the “Outputs” component to capture prediction results and any evaluation artifacts.

b. Relationships and Interactions:
- Next, the preprocessed outputs feed into the Neural Network Model component for training and/or inference.
- The Utilities functions may interact with both Preprocessing and Model components for tasks such as data normalization and logging.
- Once predictions are obtained, the data flows to the Output/Evaluation component.

c. Architectural Patterns:
- The project follows a pipeline or ETL pattern: data extraction from files, transformation via preprocessing scripts, and loading into a learning model.
- The separation between data handling, preprocessing, model training, and output generation is indicative of a modular architecture.

d. Relevant Technologies and Configuration:
- Usage of Python and NumPy (implied by .py files and .npy data files).
- The neural network might be implemented in a deep learning framework (e.g., TensorFlow or PyTorch—consider mentioning them if they are in additional documentation or inferred).
- Incorporate configuration management via config.json (and potentially config.yaml as noted in the README).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Sources
    Feature_Data["Feature Data"]:::data
    Target_Data["Target Data"]:::data

    %% Preprocessing & Augmentation Subgraph
    subgraph "Preprocessing & Augmentation"
        PD["prepare_data.py"]:::preprocess
        PP["preprocessing.py"]:::preprocess
    end

    %% Merged Preprocessing Module (aggregates outputs from the scripts)
    PRE["Preprocessing Module"]:::preprocess

    %% Neural Network Model (Training & Prediction)
    Neural_Model["Neural Network Model"]:::model

    %% Automation for Pipeline (Makefile)
    Automation["Automation (Makefile)"]:::automation

    %% Outputs & Evaluation
    Outputs_Evaluation["Outputs & Evaluation"]:::output

    %% Utils Helper Component
    Utils["Utils Helper"]:::utils

    %% Data Flow
    Feature_Data -->|"feeds"| PD
    Target_Data  -->|"feeds"| PP
    PD -->|"transformed"| PRE
    PP -->|"augments"| PRE
    PRE -->|"preprocessed data"| Neural_Model
    Neural_Model -->|"triggers"| Automation
    Automation -->|"generates"| Outputs_Evaluation

    %% Utility Support (dashed arrows)
    Utils -.->|"supports"| PRE
    Utils -.->|"supports"| Neural_Model

    %% Click Events for Data Sources
    click Feature_Data "https://github.com/siba-p/ml_surfacepoly/tree/main/data/feature"
    click Target_Data "https://github.com/siba-p/ml_surfacepoly/tree/main/data/target"

    %% Click Events for Preprocessing Scripts
    click PD "https://github.com/siba-p/ml_surfacepoly/blob/main/scripts/prepare_data.py"
    click PP "https://github.com/siba-p/ml_surfacepoly/blob/main/scripts/preprocessing.py"

    %% Click Events for Neural Network Model (Multiple mappings)
    click Neural_Model "https://github.com/siba-p/ml_surfacepoly/blob/main/config.json"
    click Neural_Model "https://github.com/siba-p/ml_surfacepoly/tree/main/Makefile"
    click Neural_Model "https://github.com/siba-p/ml_surfacepoly/blob/main/model_tested.pdf"

    %% Click Events for Outputs & Evaluation
    click Outputs_Evaluation "https://github.com/siba-p/ml_surfacepoly/tree/main/outputs"
    click Outputs_Evaluation "https://github.com/siba-p/ml_surfacepoly/blob/main/model_tested.pdf"

    %% Click Event for Utils Component
    click Utils "https://github.com/siba-p/ml_surfacepoly/blob/main/utils/helper_function.py"

    %% Click Event for Automation
    click Automation "https://github.com/siba-p/ml_surfacepoly/tree/main/Makefile"

    %% Styling Classes
    classDef data fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef preprocess fill:#FCF3CF,stroke:#B7950B,stroke-width:2px;
    classDef model fill:#D7BDE2,stroke:#6C3483,stroke-width:2px;
    classDef automation fill:#D5F5E3,stroke:#27AE60,stroke-width:2px;
    classDef output fill:#FAD7A0,stroke:#D35400,stroke-width:2px;
    classDef utils fill:#D6EAF8,stroke:#2874A6,stroke-width:2px;
```
