# giosem1/hypernegative architecture

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

- Interactive diagram: https://gitdiagram.com/giosem1/hypernegative
- Repository: https://github.com/giosem1/hypernegative

## Overview

##### Project Type and Purpose
- This is a Python library/framework (“Hypernegative”) for evaluating Hyperlink Prediction (HLP) and Negative Sampling (NS) models.
- It provides a modular, reproducible evaluation pipeline for research in HLP and NS.

##### Main Components (Packages)
a. Data & Loader Layer (e.g., hyperlink_prediction/datasets + loader)
b. Packaging & Config (setup.py, pyproject.toml, __init__.py at root)
c. Pipeline Orchestrator (pipelines package)
d. Utilities (utils package)
f. Negative Sampling Module (negative_sampling package)
g. Hyperlink Prediction Module (hyperlink_prediction package)

##### Relationships and Interactions
- Pipelines orchestrator invokes components from Data & Loader Layer, Negative Sampling Module, Hyperlink Prediction Module, and Utilities in sequence.
- Data & Loader Layer loads raw data and constructs datasets.
- Utilities provide helper functions (e.g., train/test split).
- Negative Sampling Module generates negative examples and scoring.
- Hyperlink Prediction Module trains and evaluates HLP algorithms.

##### Architectural Patterns & Design Principles
- Modular separation by concern: data ingestion, model logic, pipeline orchestration, and support utilities.
- Common interface / base classes (HyperlinkPredictionBase, NegativeSamplingAlgorithm) enforce consistency.
- Pipeline pattern: an orchestrator drives a sequence of stages.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Data & Loader Layer"
        DL1["arb_dataset.py"]:::data
        DL2["imdb_dataset.py"]:::data
        DL3["dataset_hypergraph.py"]:::data
        DL4["dataloader.py"]:::data
    end

    subgraph "Packaging & Config"
        PKG1["setup.py"]:::config
        PKG2["pyproject.toml"]:::config
        PKG3["README.md"]:::config
    end

    subgraph "Pipeline Orchestrator"
        PIPE["imdb_pipeline.py"]:::pipeline
    end

    subgraph "Utilities"
        UTIL1["hyperlink_train_test_split.py"]:::utils
        UTIL2["set_negative_samplig_method.py"]:::utils
    end

    subgraph "Sampling & Prediction"
        subgraph "Negative Sampling Module"
            NS1["hypergraph_negative_sampling.py"]:::neg
            NS2["hypergraph_negative_sampling_algorithm.py"]:::neg
            NS3["hypergraph_negative_sampling_result.py"]:::neg
        end
        subgraph "Hyperlink Prediction Module"
            HLP1["hyperlink_prediction_base.py"]:::hlp
            HLP2["hyperlink_prediction_algorithm.py"]:::hlp
            HLP3["hyperlink_prediction_result.py"]:::hlp
        end
    end

    DL4 -->|"load_data()"| PIPE
    PIPE -->|"sample_negatives()"| NS1
    PIPE -->|"train_model()"| HLP1
    PIPE -->|"util_calls()"| UTIL1

    PKG1 -.-> DL1
    PKG1 -.-> PIPE
    PKG1 -.-> UTIL1
    PKG1 -.-> NS1
    PKG1 -.-> HLP1
    PKG2 -.-> DL1
    PKG2 -.-> PIPE
    PKG2 -.-> UTIL1
    PKG2 -.-> NS1
    PKG2 -.-> HLP1
    PKG3 -.-> DL1
    PKG3 -.-> PIPE
    PKG3 -.-> UTIL1
    PKG3 -.-> NS1
    PKG3 -.-> HLP1

    click DL1 "https://github.com/giosem1/hypernegative/blob/main/hyperlink_prediction/datasets/arb_dataset.py"
    click DL2 "https://github.com/giosem1/hypernegative/blob/main/hyperlink_prediction/datasets/imdb_dataset.py"
    click DL3 "https://github.com/giosem1/hypernegative/blob/main/hyperlink_prediction/datasets/dataset_hypergraph.py"
    click DL4 "https://github.com/giosem1/hypernegative/blob/main/hyperlink_prediction/loader/dataloader.py"
    click PKG1 "https://github.com/giosem1/hypernegative/blob/main/setup.py"
    click PKG2 "https://github.com/giosem1/hypernegative/blob/main/pyproject.toml"
    click PKG3 "https://github.com/giosem1/hypernegative/blob/main/README.md"
    click PIPE "https://github.com/giosem1/hypernegative/blob/main/pipelines/imdb_pipeline.py"
    click UTIL1 "https://github.com/giosem1/hypernegative/blob/main/utils/hyperlink_train_test_split.py"
    click UTIL2 "https://github.com/giosem1/hypernegative/blob/main/utils/set_negative_samplig_method.py"
    click NS1 "https://github.com/giosem1/hypernegative/blob/main/negative_sampling/hypergraph_negative_sampling.py"
    click NS2 "https://github.com/giosem1/hypernegative/blob/main/negative_sampling/hypergraph_negative_sampling_algorithm.py"
    click NS3 "https://github.com/giosem1/hypernegative/blob/main/negative_sampling/hypergraph_negative_sampling_result.py"
    click HLP1 "https://github.com/giosem1/hypernegative/blob/main/hyperlink_prediction/hyperlink_prediction_base.py"
    click HLP2 "https://github.com/giosem1/hypernegative/blob/main/hyperlink_prediction/hyperlink_prediction_algorithm.py"
    click HLP3 "https://github.com/giosem1/hypernegative/blob/main/hyperlink_prediction/hyperlink_prediction_result.py"

    classDef data fill:#AEC6CF,stroke:#333,stroke-width:1px
    classDef config fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef pipeline fill:#C1E1C1,stroke:#333,stroke-width:1px
    classDef utils fill:#FDFD96,stroke:#333,stroke-width:1px
    classDef neg fill:#FFB347,stroke:#333,stroke-width:1px
    classDef hlp fill:#B39EB5,stroke:#333,stroke-width:1px
    classDef samplingPred fill:#FFCCCB,stroke:#333,stroke-width:1px
```
