How hieptk/accent works
Main Components
a. Data Layer:
• Data for NCF: Located in NCF/data with the MovieLens training file (movielens_train.tsv).
• Data for RCF: Located in RCF/data, including train.csv, test.csv, u.data, auxiliary-mapping.txt, and relational_data.csv.
b. Model Components:
• NCF Module:
• Core implementation files in NCF/src (e.g., train.py, experiment.py, get_rec.py, etc.).
• A specific “influence” submodule in NCF/src/influence for influence function implementation.
• Scripts folder (NCF/src/scripts) which contains auxiliary and support scripts.
• RCF Module:
• Main implementation files in RCF/src (e.g., train.py, experiment.py, rcf.py, pure_attention.py, etc.).
c. Common Utilities:
• Commons directory contains template and helper scripts (e.g., accent_template.py, fia_template.py, explanation_algorithm_template.py, helper.py).
• Other standalone files like compare.py for evaluation and significance testing.
d. Environment and Configuration:
• Requirements file (requirements.txt) and an initialization script (init) to set up the environment.
• LICENSE and README provide context for experimental setup and usage.
Relationships and Interactions
• Data Flow:
• Data is preprocessed (as shown by scripts like generate_data.py in RCF/src and load_movielens.py in NCF/src/scripts) and fed into each recommender system.
• Each system (NCF and RCF) has its own training pipeline (train.py) that reads from the data layer, builds a model using the provided frameworks (such as TensorFlow), and saves the trained models (e.g., “pretrain-rcf” directory for RCF).
• Experiment and Explanation Pipeline:
• Once a model is trained, the experiment scripts (experiment.py in both NCF/src and RCF/src) invoke different counterfactual explanation algorithms.
• These experiments result in output CSV files containing the evaluation results (with scores, predicted results, and counterfactual explanations).
• Evaluation and Significance Testing:
• The compare.py script is used to analyze the explanation quality, run t-tests and McNemar’s tests, and generate comparative metrics between the results of different explanation methods.
• Common Modules and Reusability:
• Shared functionality is abstracted out in the “commons” directory and reusable helper functions that support both NCF and RCF pipelines.
Architectural Patterns and Design Principles
• Modularity: The project is split into two parallel modules (NCF and RCF) with similar structures, encapsulating the functionality for different recommender models.
• Separation of Concerns: Data processing, model training, explanation generation, and evaluation are all separated into distinct directories and scripts.
• Reusability: Common functionalities such as helper functions and templates are isolated into their own directory (commons), promoting code reuse.
• Experimentation Workflow: The design clearly supports conducting experiments and statistical testing, an important element of research codebases.