This repository provides a pipeline for classifying Amazon product reviews into a large-scale taxonomy of 531 hierarchical classes.
The system enforces hierarchy by using balanced sampling, top-down LLM path selection, and bidirectional GNN propagation, achieving stable supervision over 531 taxonomy classes.
Python 3.8+ is required.
All dependencies can be installed with:
pip install torch numpy tqdm openai sentence-transformers scikit-learn matplotlibIf silver labels have not yet been generated, first set your OpenAI API key:
export OPENAI_API_KEY="your-api-key-here"
⚠️ Silver Label Caching (Reproducibility Notice)
To ensure cost efficiency and fast reproduction, this pipeline includes an automatic caching mechanism:
- Cache Check: The script checks for
teacher_1k.jsonin the project root. - Skip API Calls: If the file exists, all OpenAI API calls are skipped and the pipeline directly proceeds to GNN training using the cached silver labels.
- No API Key Required: When cached labels are present, the full pipeline can run without an OpenAI API key.
This enables deterministic experiments while avoiding unnecessary API costs.
Run the full pipeline by executing the following command in your terminal:python gnn_pipeline_final.pyFor any questions or inquiries regarding this repository, please contact:
Jiyun Kim (김지연)
Email: kimjiyun138@gmail.com