### Navigate to Evaluation Directory Source: https://github.com/lhrlab/hypergraphrag/blob/main/evaluation/README.md Changes the current working directory to 'evaluation' to begin the setup process for HyperGraphRAG evaluation. ```bash cd evaluation ``` -------------------------------- ### Setup HyperGraphRAG Environment Source: https://github.com/lhrlab/hypergraphrag/blob/main/README.md This snippet details the steps to set up a Python environment for HyperGraphRAG using Conda and install the necessary dependencies from a requirements file. ```bash conda create -n hypergraphrag python=3.11 conda activate hypergraphrag pip install -r requirements.txt ``` -------------------------------- ### Construct Knowledge Hypergraph Source: https://github.com/lhrlab/hypergraphrag/blob/main/evaluation/README.md Initiates the process of building the knowledge hypergraph using the 'script_insert.py' script. It runs in the background and logs output to a file. The example shows construction for 'hypertension', with commented-out lines for other datasets. ```bash nohup python script_insert.py --cls hypertension > result_hypertension_insert.log 2>&1 & # nohup python script_insert.py --cls agriculture > result_agriculture_insert.log 2>&1 & # nohup python script_insert.py --cls cs > result_cs_insert.log 2>&1 & # nohup python script_insert.py --cls legal > result_legal_insert.log 2>&1 & # nohup python script_insert.py --cls mix > result_mix_insert.log 2>&1 & ``` -------------------------------- ### View Evaluation Results Source: https://github.com/lhrlab/hypergraphrag/blob/main/evaluation/README.md Displays the evaluation results using 'see_score.py', specifying the data source and the method. This command is used to review the performance metrics obtained from the previous step. Examples for different methods are commented out. ```bash python see_score.py --data_source hypertension --method HyperGraphRAG # python see_score.py --data_source hypertension --method StandardRAG # python see_score.py --data_source hypertension --method NaiveGeneration ``` -------------------------------- ### Evaluate Generation Performance Source: https://github.com/lhrlab/hypergraphrag/blob/main/evaluation/README.md Evaluates the generated content using 'get_score.py', specifying the data source and the method used for generation. It also sets the CUDA visible devices. The example evaluates 'HyperGraphRAG' for 'hypertension'. ```bash CUDA_VISIBLE_DEVICES=0 python get_score.py --data_source hypertension --method HyperGraphRAG # CUDA_VISIBLE_DEVICES=0 python get_score.py --data_source hypertension --method StandardRAG # CUDA_VISIBLE_DEVICES=0 python get_score.py --data_source hypertension --method NaiveGeneration ``` -------------------------------- ### Generate Based on Retrieved Knowledge Source: https://github.com/lhrlab/hypergraphrag/blob/main/evaluation/README.md Generates content based on retrieved knowledge using 'get_generation.py'. It specifies the data sources and the generation method. The example shows generation for 'hypertension' using 'HyperGraphRAG', with other methods commented out. ```bash python get_generation.py --data_sources hypertension --methods HyperGraphRAG # python get_generation.py --data_sources hypertension --methods StandardRAG # python get_generation.py --data_sources hypertension --methods NaiveGeneration ``` -------------------------------- ### Retrieve Knowledge with HyperGraphRAG Source: https://github.com/lhrlab/hypergraphrag/blob/main/evaluation/README.md Retrieves knowledge using the 'script_hypergraphrag.py' script, specifying the data source. This command is part of the retrieval step in the evaluation process. Alternative retrieval methods are commented out. ```bash python script_hypergraphrag.py --data_source hypertension # python script_standardrag.py --data_source hypertension # python script_naivegeneration.py --data_source hypertension ``` -------------------------------- ### Construct Knowledge HyperGraph with HyperGraphRAG Source: https://github.com/lhrlab/hypergraphrag/blob/main/README.md Demonstrates how to initialize HyperGraphRAG and insert unique contexts to build a knowledge hypergraph. It requires setting the OpenAI API key and providing context data in a JSON file. ```python import os import json from hypergraphrag import HyperGraphRAG os.environ["OPENAI_API_KEY"] = "your_openai_api_key" rag = HyperGraphRAG(working_dir=f"expr/example") with open(f"example_contexts.json", mode="r") as f: unique_contexts = json.load(f) rag.insert(unique_contexts) ``` -------------------------------- ### Query Knowledge HyperGraph with HyperGraphRAG Source: https://github.com/lhrlab/hypergraphrag/blob/main/README.md Shows how to query the constructed knowledge hypergraph using HyperGraphRAG. This involves initializing the RAG system with the working directory and providing a natural language query. ```python import os from hypergraphrag import HyperGraphRAG os.environ["OPENAI_API_KEY"] = "your_openai_api_key" rag = HyperGraphRAG(working_dir=f"expr/example") query_text = 'How strong is the evidence supporting a systolic BP target of 120–129 mmHg in elderly or frail patients, considering potential risks like orthostatic hypotension, the balance between cardiovascular benefits and adverse effects, and the feasibility of implementation in diverse healthcare settings?' result = rag.query(query_text) print(result) ``` -------------------------------- ### HyperGraphRAG Citation Source: https://github.com/lhrlab/hypergraphrag/blob/main/README.md Provides the BibTeX entry for citing the HyperGraphRAG paper, which details the Retrieval-Augmented Generation via Hypergraph-Structured Knowledge Representation. ```bibtex @misc{luo2025hypergraphrag, title={HyperGraphRAG: Retrieval-Augmented Generation via Hypergraph-Structured Knowledge Representation}, author={Haoran Luo and Haihong E and Guanting Chen and Yandan Zheng and Xiaobao Wu and Yikai Guo and Qika Lin and Yu Feng and Zemin Kuang and Meina Song and Yifan Zhu and Luu Anh Tuan}, year={2025}, eprint={2503.21322}, archivePrefix={arXiv}, primaryClass={cs.AI}, url={https://arxiv.org/abs/2503.21322}, } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.