This script is designed to generate explanations using a language model based on specified parameters and datasets. It allows users to customize various aspects of the explanation generation process through command-line arguments.
- Python 3.12
- Required Python packages (install using
pip install -r requirements.txtif a requirements file is provided)
Run the script from the command line:
python main.py [options]The script accepts the following command-line arguments:
- Type:
str - Default:
'0.5' - Description: Parameter value used in the explanation generation process.
- Type:
float - Default:
0.1 - Description: Controls the randomness of the language model's output. A lower value makes the output more deterministic, while a higher value increases randomness.
- Type:
float - Default:
0.8 - Description: Implements nucleus sampling by selecting tokens with a cumulative probability up to
top_p. This controls the diversity of the output.
- Type:
str - Default:
'cora' - Description: The name of the dataset to be used. Ensure the dataset is available in your environment.
- Type:
int - Default:
2048 - Description: The maximum number of tokens to generate in the output.
- Type:
float - Default:
1.05 - Description: Penalty applied to reduce the likelihood of repeating the same token. Values greater than
1.0discourage repetition.
- Type:
str - Default:
'cf-gnnfeatures' - Description: Specifies the explanation method to be used. Options depend on the implementations available in the
src.llmsmodule.
python main.pypython main.py --parameters '0.7' --temperature 0.5 --top_p 0.9 --dataset 'pubmed' --max_tokens 1024 --repetition_penalty 1.1 --explainer 'your_explainer'You can run the experiments using the experiments script.
bash experiments.shTo evaluate the results type:
python src/evaluation.pyThe folder data contains data coming from CF-GNNExplainer and CF-GNNFeatures explainers using the graph incident format. The explainers are NOT included in this repo!