# gabriben/recfusion architecture

> Architecture diagram of the GitHub repository gabriben/recfusion, 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/gabriben/recfusion
- Repository: https://github.com/gabriben/recfusion

## Overview

##### High-Level Components

a) Core Components:
- Algorithms Layer
- Dataset Management
- Pipeline Management
- Evaluation System
- Matrix Operations
- Scenarios Handler

##### Detailed Component Breakdown

a) Algorithms Layer (Central Component):
- Base Algorithm Components
- RecFusion Variants (RecfusionBin, RecfusionMLP, RecfusionUnet1D, etc.)
- Traditional Algorithms (EASE, SLIM, VAE variants)
- Time-Aware Algorithms

b) Data Flow Components:
- Dataset Handlers (MovieLens, Netflix, etc.)
- Preprocessing Pipeline
- Matrix Operations
- Post-processing Pipeline

c) Evaluation Framework:
- Metrics system showing:
- Various Metric Types (Coverage, DCG, Diversity, etc.)
- Scenario Handlers (Strong/Weak Generalization)
- Pipeline Evaluation Flow

##### Integration Points

a) External Services:
- WandB integration for experiment tracking
- Hyperparameter optimization pipeline
- Demonstrate parallel execution capability

##### Specific Implementation Details

Use these visual elements:
- Rectangles: Core components
- Hexagons: Processing units
- Diamonds: Decision points

##### Layer Organization

From bottom to top:

##### Important Connections to Highlight

- How the RecFusion variants interact with the base algorithm structure
- Demonstrate the pipeline flow from data input to final evaluation
- How the hyperparameter optimization connects to the main system
- Parallel execution capabilities

##### Technical Details

- Matrix operations flow
- Different scenario types (weak/strong generalization)
- Metric calculation pipeline
- Algorithm selection and execution flow

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Data_Layer
        DH[Dataset Handlers]
        ML[MovieLens]
        NF[Netflix]
        DH --> ML & NF
    end

    subgraph Processing_Layer
        Pre[Preprocessing]
        Post[Postprocessing]
        MO[Matrix Operations]
    end

    subgraph Algorithms_Layer
        BC[Base Components]
        
        subgraph RecFusion_Variants
            RB[RecFusionBin]
            RM[RecFusionMLP]
            RU[RecFusionUnet1D]
        end
        
        subgraph Traditional_Algorithms
            EASE[EASE]
            SLIM[SLIM]
            VAE[MultVAE]
        end
        
        TAA[Time-Aware Algorithms]
    end

    subgraph Pipeline_Layer
        MP[Main Pipeline]
        HPO[Hyperparameter Optimization]
        PB[Pipeline Builder]
    end

    subgraph Evaluation_Layer
        subgraph Metrics
            COV[Coverage]
            DCG[DCG]
            DIV[Diversity]
        end
        
        subgraph Scenarios
            SG[Strong Generalization]
            WG[Weak Generalization]
        end
    end

    subgraph Monitoring_Layer
        WB[WandB Integration]
    end

    %% Data Flow
    Data_Layer --> Pre
    Pre --> MO
    MO --> Algorithms_Layer
    Algorithms_Layer --> Post
    Post --> Evaluation_Layer
    Evaluation_Layer --> WB

    %% Pipeline Control
    MP --> Pre & Post
    HPO --> Algorithms_Layer
    PB --> MP

    %% Style Definitions
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:1px
    classDef core fill:#e1f5fe,stroke:#01579b
    classDef processing fill:#f3e5f5,stroke:#4a148c
    classDef eval fill:#e8f5e9,stroke:#1b5e20
    classDef monitoring fill:#fff3e0,stroke:#e65100

    %% Apply Styles
    class BC,RB,RM,RU,EASE,SLIM,VAE,TAA core
    class Pre,Post,MO processing
    class COV,DCG,DIV,SG,WG eval
    class WB monitoring

    %% Click Events
    click DH "https://github.com/gabriben/recfusion/tree/master/recpack/datasets/"
    click ML "https://github.com/gabriben/recfusion/blob/master/recpack/datasets/movielens.py"
    click NF "https://github.com/gabriben/recfusion/blob/master/recpack/datasets/netflix.py"
    click Pre "https://github.com/gabriben/recfusion/blob/master/recpack/preprocessing/preprocessors.py"
    click Post "https://github.com/gabriben/recfusion/blob/master/recpack/postprocessing/postprocessors.py"
    click MO "https://github.com/gabriben/recfusion/blob/master/recpack/matrix/interaction_matrix.py"
    click BC "https://github.com/gabriben/recfusion/blob/master/recpack/algorithms/base.py"
    click RB "https://github.com/gabriben/recfusion/blob/master/recpack/algorithms/recfusionBin.py"
    click RM "https://github.com/gabriben/recfusion/blob/master/recpack/algorithms/recfusionMLP.py"
    click RU "https://github.com/gabriben/recfusion/blob/master/recpack/algorithms/recfusionUnet1D.py"
    click EASE "https://github.com/gabriben/recfusion/blob/master/recpack/algorithms/ease.py"
    click SLIM "https://github.com/gabriben/recfusion/blob/master/recpack/algorithms/slim.py"
    click VAE "https://github.com/gabriben/recfusion/blob/master/recpack/algorithms/mult_vae.py"
    click TAA "https://github.com/gabriben/recfusion/tree/master/recpack/algorithms/time_aware_item_knn/"
    click MP "https://github.com/gabriben/recfusion/blob/master/recpack/pipelines/pipeline.py"
    click HPO "https://github.com/gabriben/recfusion/blob/master/recpack/pipelines/hyperparameter_optimisation.py"
    click PB "https://github.com/gabriben/recfusion/blob/master/recpack/pipelines/pipeline_builder.py"
    click COV "https://github.com/gabriben/recfusion/blob/master/recpack/metrics/coverage.py"
    click DCG "https://github.com/gabriben/recfusion/blob/master/recpack/metrics/dcg.py"
    click DIV "https://github.com/gabriben/recfusion/blob/master/recpack/metrics/diversity.py"
    click SG "https://github.com/gabriben/recfusion/blob/master/recpack/scenarios/strong_generalization.py"
    click WG "https://github.com/gabriben/recfusion/blob/master/recpack/scenarios/weak_generalization.py"
    click WB "https://github.com/gabriben/recfusion/tree/master/wandb/"
```
