Bias CRS
1.0.0
apt-get update
apt-get install build-essential -y
Preparing enviroment:
(for torch 1.12.0)
Option 1:
pip install pyg-lib torch-scatter torch-sparse torch-cluster torch-spline-conv torch-geometric -f https://data.pyg.org/whl/torch-1.12.0+cu113.html
export LD_LIBRARY_PATH="/opt/conda/lib/:$LD_LIBRARY_PATH"
Option 2:
pip install torch==1.12.0+cu113 torchvision==0.13.0+cu113 torchaudio==0.12.0 --extra-index-url https://download.pytorch.org/whl/cu113
pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-${TORCH}+${CUDA}.html
pip install torch-sparse -f https://pytorch-geometric.com/whl/torch-${TORCH}+${CUDA}.html
pip install torch-cluster -f https://pytorch-geometric.com/whl/torch-${TORCH}+${CUDA}.html
pip install torch-spline-conv -f https://pytorch-geometric.com/whl/torch-${TORCH}+${CUDA}.html
pip install torch-geometric
pip install -r requirements.txt
For the case of "command 'x86_64-linux-gnu-gcc' failed with exit status 1":
apt-get install python3.x-dev
python run_bias_crs.py --config config/crs/tgredial/tgredial.yaml
实验在 ReDial、KGSF、KBRD 和 TGReDial 模型上进行,并在 ReDIAL 和 TGReDIAL 数据集上进行评估。
合成对话的生成和准备首先由 data_aug 文件夹中的 [data_prep_gen_ .ipynb] 和 [gen_convert_ .ipynb] 实现(* 指数据集名称)。
数据增强是在[bias_crs/data/dataloader/base.py]内的base.py中实现的,而通过popNudge对要增强的项目数量的更改可以从这里更改。
每次运行的实验结果都将保存在[data/bias/]目录下,后面是以模型和数据集名称命名的文件夹,标题为[bias_anlytic_data.csv]。
通过跨剧集流行度和面向用户意图的流行度评分对推荐结果进行相应的分析,可以通过[分析]文件夹访问。
from scipy.stats.stats import pearsonr
def compute_pop_scores(pop_score_dict, items):
return [pop_score_dict[item] if item in pop_score_dict else 0.0 for item in items]
pop_scores = [compute_pop_scores(pop_score_dict, row['Prediction_items']) for _, row in data.iterrows()]
data['pop_scores'] = pop_scores
new_conv = True
cep_scores = []
for idx, row in data.iterrows():
# set the default value to the first episode
if new_conv:
new_conv = False
cep_scores.append(0.5)
else:
if idx+1 < len(data) and row['conv_id'] != data.at[idx+1, 'conv_id']:
new_conv=True
pearsonr_score = np.abs(pearsonr(row['pop_scores'], data.at[idx-1, 'pop_scores'])[0])
cep_scores.append(pearsonr_score)
data['cep_score'] = cep_scores
data['cep_pop_score'] = data['cep_score'] * data['pop_bias']
data['target_pop_score'] = data['target_item_index'].map(pop_score_dict)
data['UIOP'] = np.abs(data['pop_bias'] - data['target_pop_score'])
@inproceedings{
title={Improving Conversational Recommendation Systems via Bias Analysis and Language-Model-Enhanced Data Augmentation},
author={Xi Wang, Hossein A. Rahmani, Jiqun Liu, Emine Yilmaz}
booktitle={Proceedings of EMNLP 2023 (Findings)}
year={2023}
}
该存储库是基于CRSLab框架开发的[https://github.com/RUCAIBox/CRSLab]。感谢他们为实现该项目中模型的系统开发和评估做出的宝贵贡献。