# zhongqiangwu960812/ai-recommendersystem architecture

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

- Interactive diagram: https://gitdiagram.com/zhongqiangwu960812/ai-recommendersystem
- Repository: https://github.com/zhongqiangwu960812/ai-recommendersystem

## Overview

##### Project Type and Purpose
- This is a learning and experimental repository for recommender system models.
- It organizes different modes of recommendation—both recall (e.g., collaborative filtering, content-based, NeuralCF, etc.) and ranking (e.g., DeepFM, DCN, DIN, Wide&Deep, AFM, etc.)—and explains the evolution of models from basic algorithms to deep learning variants.
- The README emphasizes that these modules are meant to help the user understand the principles behind each model, with code variations in different frameworks (TF and PyTorch) and experimental notebooks.

##### Analyzing the File Structure
- At the top-level, the “Dataset” directory contains data sampling and pre-processing notebooks; this is the entry point for data ingestion.
- The “Rank” directory houses multiple subdirectories for various ranking models (such as AFM, AutoInt, DCN, DIEN, DIN, DSIN, DeepFM, Deep_Crossing, FiBiNet, GBDT+LR, MMOE, NFM, PNN, WideDeep, xDeepFM). Each of these subdirectories hosts notebooks, pre-processed data folders, model files, and sometimes a README explaining the specific approach.
- The “Recall” directory similarly groups multiple recall approaches: collaborative filtering, content-based, FM/FFM variants, LFM/MF, NeuralCF, SDM, YoutubeDNN, and even separate experimental directories for multi-task loss optimizations.
- The structure further shows that each model often has its own “data”, “model”, and “utils” folders or notebooks. This pattern suggests that at each node (each algorithm module), there is a standard development lifecycle: data ingestion → preprocessing → model training → evaluation.

##### Key Components and Their Relationships
a. Data Ingestion and Preprocessing:
– The “Dataset” folder and data subdirectories (found within each model’s directory such as preprocessed_data, data) represent the raw and cleaned data components.
– This front-end data pipeline is common to both recall and ranking models.

b. Model Categories:
– Under Ranking: Represent nodes for each algorithm (AFM, DeepFM, DIN, etc.) and note that they sometimes further split based on implementation style (e.g., “TraditionalPytorchStyle” vs “DeepCTRStyle”).
– Under Recall: Represent collaborative filtering approaches, content-based recommendation, latent-factor models (LFM_MF), NeuralCF, SDM, and others.

c. Architectural Patterns and Data Flow:
– The main architecture reflects a typical recommender system pipeline: raw data → feature processing → model training → inference/experiment evaluation.
– Since many components are implemented as notebooks (ipynb) for demonstration and experimentation, you may indicate this as “Code Notebook” components or “Interactive Experiment” nodes.

d. Technologies and Design Principles:
– The repository emphasizes modularity—each model’s directory is self-contained with its own data, preprocessing, and model training scripts.
– While this is not a production system per se, the emphasis on “data flow” and “model experimentation” should be captured in the design.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Top level nodes
    DATA("Data Ingestion & Preprocessing"):::data
    RANK("Ranking Modules"):::rankGroup
    RECALL("Recall Modules"):::recallGroup
    EXP("Experimental Modules"):::expGroup

    %% Connect data ingestion to module groups
    DATA --> RANK
    DATA --> RECALL
    DATA --> EXP

    %% Ranking Modules breakdown (using representative connectors)
    RANK --> GBDTLR["GBDT+LR"]:::rank
    RANK --> DCN["DCN"]:::rank
    RANK --> AFM["AFM"]:::rank

    %% Subgroup: Ranking - Traditional Models
    subgraph "Ranking: Traditional Models"
        GBDTLR
    end

    %% Subgroup: Ranking - Deep Models
    subgraph "Ranking: Deep Models"
        DCN
        DeepCrossing["Deep Crossing"]:::rank
        WideDeep["Wide & Deep"]:::rank
        DeepFM["DeepFM"]:::rank
        NFM["NFM"]:::rank
        MMOE["MMOE"]:::rank
        PNN["PNN"]:::rank
    end

    %% Subgroup: Ranking - Attention Models
    subgraph "Ranking: Attention Models"
        AFM
        AutoInt["AutoInt"]:::rank
        DIEN["DIEN"]:::rank
        DIN["DIN"]:::rank
        DSIN["DSIN"]:::rank
        FiBiNet["FiBiNet"]:::rank
        xDeepFM["xDeepFM"]:::rank
    end

    %% Recall Modules breakdown (using representative connector)
    RECALL --> CollaborativeCF["Collaborative Filtering"]:::recall

    subgraph "Recall Modules List"
        CollaborativeCF
        ContentBased["Content-Based Recommendation"]:::recall
        FM_FFM["FM/FFM Models"]:::recall
        LFM_MF["Latent Factor Models (LFM/MF)"]:::recall
        MIND["MIND"]:::recall
        NeuralCF["Neural Collaborative Filtering"]:::recall
        SDM["Session-based/Sequential Model (SDM)"]:::recall
        YoutubeDNN["YoutubeDNN"]:::recall
    end

    %% Experimental Module
    EXP --> MultiTask["Multi-task Loss Optimization"]:::exp

    %% Click Events for Data Ingestion
    click DATA "https://github.com/zhongqiangwu960812/ai-recommendersystem/blob/master/Dataset/EDA与数据预处理.ipynb"

    %% Click Events for Ranking Models
    click AFM "https://github.com/zhongqiangwu960812/ai-recommendersystem/tree/master/Rank/AFM"
    click AutoInt "https://github.com/zhongqiangwu960812/ai-recommendersystem/tree/master/Rank/AutoInt"
    click DCN "https://github.com/zhongqiangwu960812/ai-recommendersystem/tree/master/Rank/DCN"
    click DIEN "https://github.com/zhongqiangwu960812/ai-recommendersystem/tree/master/Rank/DIEN"
    click DIN "https://github.com/zhongqiangwu960812/ai-recommendersystem/tree/master/Rank/DIN"
    click DSIN "https://github.com/zhongqiangwu960812/ai-recommendersystem/tree/master/Rank/DSIN"
    click DeepFM "https://github.com/zhongqiangwu960812/ai-recommendersystem/tree/master/Rank/DeepFM"
    click DeepCrossing "https://github.com/zhongqiangwu960812/ai-recommendersystem/tree/master/Rank/Deep_Crossing"
    click FiBiNet "https://github.com/zhongqiangwu960812/ai-recommendersystem/tree/master/Rank/FiBiNet"
    click GBDTLR "https://github.com/zhongqiangwu960812/ai-recommendersystem/tree/master/Rank/GBDT+LR"
    click MMOE "https://github.com/zhongqiangwu960812/ai-recommendersystem/tree/master/Rank/MMOE"
    click NFM "https://github.com/zhongqiangwu960812/ai-recommendersystem/tree/master/Rank/NFM"
    click PNN "https://github.com/zhongqiangwu960812/ai-recommendersystem/tree/master/Rank/PNN"
    click WideDeep "https://github.com/zhongqiangwu960812/ai-recommendersystem/tree/master/Rank/WideDeep"
    click xDeepFM "https://github.com/zhongqiangwu960812/ai-recommendersystem/tree/master/Rank/xDeepFM"

    %% Click Events for Recall Models
    click CollaborativeCF "https://github.com/zhongqiangwu960812/ai-recommendersystem/tree/master/Recall/CollaborativeFiltering"
    click ContentBased "https://github.com/zhongqiangwu960812/ai-recommendersystem/tree/master/Recall/ContentBasedRecommend"
    click FM_FFM "https://github.com/zhongqiangwu960812/ai-recommendersystem/tree/master/Recall/FM_FFM"
    click LFM_MF "https://github.com/zhongqiangwu960812/ai-recommendersystem/tree/master/Recall/LFM_MF"
    click MIND "https://github.com/zhongqiangwu960812/ai-recommendersystem/tree/master/Recall/MIND"
    click NeuralCF "https://github.com/zhongqiangwu960812/ai-recommendersystem/tree/master/Recall/NeuralCF"
    click SDM "https://github.com/zhongqiangwu960812/ai-recommendersystem/tree/master/Recall/SDM"
    click YoutubeDNN "https://github.com/zhongqiangwu960812/ai-recommendersystem/tree/master/Recall/YoutubeDNN"

    %% Click Event for Experimental Module
    click MultiTask "https://github.com/zhongqiangwu960812/ai-recommendersystem/tree/master/多任务loss优化实验"

    %% Styles
    classDef data fill:#FFD700,stroke:#333,stroke-width:2px,color:#000;
    classDef rankGroup fill:#ADD8E6,stroke:#333,stroke-width:2px,color:#000;
    classDef recallGroup fill:#90EE90,stroke:#333,stroke-width:2px,color:#000;
    classDef expGroup fill:#FFA07A,stroke:#333,stroke-width:2px,color:#000;
    classDef rank fill:#87CEFA,stroke:#333,color:#000;
    classDef recall fill:#98FB98,stroke:#333,color:#000;
    classDef exp fill:#FFB6C1,stroke:#333,color:#000;
```
