How kang205/sasrec works
Main Components
• Data Component:
• This includes the datasets (files in the “data” directory such as Beauty.txt, Steam.txt, Video.txt, ml-1m.txt) and the data processing functionality (data/DataProcessing.py). These files hold the raw user-item interactions and implement pre-processing.
• Model Definition and Components:
• The core deep learning model is defined in model.py.
• Additional model functionalities or submodules that implement self-attention may be defined in modules.py.
• Training and Execution Module:
• main.py is the primary entry point for training.
• sampler.py likely handles data sampling (for creating batches or sequences) during training.
• util.py contains utility functions/helpers that support different parts of the system.
• External Dependencies & References:
• That the project mentions TensorFlow 1.12 and Python 2 as part of its execution environment, and it utilizes self-attention code inspired by another open-source transformer project.
Relationships and Interactions
• Data Flow:
• Datasets (from the “data” directory) are fed into the pre-processing routines (scripts in data/DataProcessing.py), transforming raw text files into the expected input format.
• Model Execution:
• main.py orchestrates the training process. It leverages sampler.py to extract training batches from processed data, calls model.py (and indirectly modules.py) to build the self-attention based recommendation model, and utilizes util.py for any supporting operations.
• System Dependencies:
• The TensorFlow framework underpins the model training and execution, while Python scripts tie all components together.
• External Services:
• Although not directly illustrated in code, the README references external datasets and their processing, which could be noted as potential external data sources.
Architectural Patterns and Design Principles
• Separation of Concerns:
• Data ingestion and pre-processing (in the “data” directory) are isolated from model creation and training logic.
• Modularity is apparent among different Python scripts: main.py for execution, model.py for architecture, and sampler/util for supporting functionalities.
• Pipeline Design:
• The design maps to a typical ML pipeline, where raw data is processed, a model is built and trained, and then outcomes (e.g., convergence curves) are analyzed.