代码位于my_code
文件夹,默认IDE
为pycharm
,主要包含了温度伸缩实验的代码。
在你创建了环境python 3.6
之后,下面的命令可以帮助你安装需要的包:
- pip install numpy
- pip install pandas
- pip install matplotlib
- pip install openpyxl
或者你也可以通过直接配置pycharm
以配置上述包。
判断生成token
或者word
是否正确采用levenshtein
算法,具体实现见levenshtein.py
。其中在文件末尾给出了使用样例。
T_scaling.py
为未排序token
级别温度实验的代码。通过改变读取json
文件处的代码来改变读取的数据。功能模块通过##
分块,通过ctrl+enter
运行单个模块。各模块功能依次为初始化,计算各温度对应ECE
,将ECE-T
数据写入excel
文件,绘制ECE-T
曲线,将accuracy-confidence
数据写入excel
文件,绘制accuracy-confidence
曲线。
T_scaling_sort.py
为经过排序token
级别温度实验的代码。通过改变读取json
文件处的代码来改变读取的数据。功能模块通过##
分块,通过ctrl+enter
运行单个模块。各模块功能与T_scaling.py
中相同。
T_scaling_word.py
为未排序word
级别温度实验的代码。通过改变读取json
文件处的代码来改变读取的数据。功能模块通过##
分块,通过ctrl+enter
运行单个模块。各模块功能与T_scaling.py
中相同。
T_scaling_sort_word.py
为经过排序word
级别温度实验的代码。通过改变读取json
文件处的代码来改变读取的数据。功能模块通过##
分块,通过ctrl+enter
运行单个模块。各模块功能与T_scaling.py
中相同。
T_scaling_divide.py
为经过排序分domain
,slot
,value
温度实验的代码。通过改变读取json
文件处的代码来改变读取的数据。功能模块通过##
分块,通过ctrl+enter
运行单个模块。各模块功能依次为初始化,计算各温度对应ECE
并将ECE-T
数据写入excel
文件,绘制ECE-T
曲线,将accuracy-confidence
数据写入excel
文件,绘制accuracy-confidence
曲线。
代码位于SGA-JRUD-master
文件夹中,在服务器13
上,在其中的位置为/mnt/workspace/liuhong/wangyb/SGA-JRUD-master
。
在你创建了环境python 3.6
之后,下面的命令可以帮助你安装需要的包:
- pip install torch==1.5
- pip install transformers==3.5
- pip install spacy==3.1
- python -m spacy download en_core_web_sm
- pip install nltk
- pip install sklearn
- pip install tensorboard
- pip install future
此外,为了评估,你需要安装 standard evaluation repository , 其中我们改变了 mwzeval/utils.py/load_references()
中的references
为 damd
, 由于我们采用了与 DAMD中相同的去词汇化。
处理的数据在目录data/
中,通过以下代码解压,
unzip data/data.zip -d data/
如果要从头开始预处理,你需要下载MultiWOZ2.1到data/
中然后对其进行解压,然后执行下述命令:
python data_analysis.py
python preprocess.py
此外,数据库文件也是需要的:
unzip db.zip
train_nce.py
文件中为使用nce
方法训练的代码,通过修改train_nce.sh
来改变其参数。运行方式为:
bash train_nce.sh $GPU ${your_exp_name}
e.g.
bash train_nce.sh 0 DS-baseline
train_dnce.py
文件中为使用dnce
方法训练的代码,通过修改train_dnce.sh
来改变其参数。运行方式为:
bash train_dnce.sh $GPU ${your_exp_name}
e.g.
bash train_dnce.sh 0 DS-baseline
train_residual.py
文件中为使用残差能量模型方法训练的代码,通过修改train_residual.sh
来改变其参数。运行方式为:
bash train_residual.sh $GPU ${your_exp_name}
e.g.
bash train_residual.sh 0 DS-baseline