Giter Site home page Giter Site logo

wyb_graduation's Introduction

wyb_graduation

温度伸缩实验

代码位于my_code文件夹,默认IDEpycharm,主要包含了温度伸缩实验的代码。

环境配置

在你创建了环境python 3.6之后,下面的命令可以帮助你安装需要的包:

  • pip install numpy
  • pip install pandas
  • pip install matplotlib
  • pip install openpyxl

或者你也可以通过直接配置pycharm以配置上述包。

实验

判断生成token或者word是否正确采用levenshtein算法,具体实现见levenshtein.py。其中在文件末尾给出了使用样例。

未排序token级别温度实验

T_scaling.py为未排序token级别温度实验的代码。通过改变读取json文件处的代码来改变读取的数据。功能模块通过##分块,通过ctrl+enter运行单个模块。各模块功能依次为初始化,计算各温度对应ECE,将ECE-T数据写入excel文件,绘制ECE-T曲线,将accuracy-confidence数据写入excel文件,绘制accuracy-confidence曲线。

已排序token级别温度实验

T_scaling_sort.py为经过排序token级别温度实验的代码。通过改变读取json文件处的代码来改变读取的数据。功能模块通过##分块,通过ctrl+enter运行单个模块。各模块功能与T_scaling.py中相同。

未排序word级别温度实验

T_scaling_word.py为未排序word级别温度实验的代码。通过改变读取json文件处的代码来改变读取的数据。功能模块通过##分块,通过ctrl+enter运行单个模块。各模块功能与T_scaling.py中相同。

已排序word级别温度实验

T_scaling_sort_word.py为经过排序word级别温度实验的代码。通过改变读取json文件处的代码来改变读取的数据。功能模块通过##分块,通过ctrl+enter运行单个模块。各模块功能与T_scaling.py中相同。

已排序分domain,slot,value温度实验

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() 中的referencesdamd, 由于我们采用了与 DAMD中相同的去词汇化。

数据预处理

处理的数据在目录data/中,通过以下代码解压,

unzip data/data.zip -d data/

如果要从头开始预处理,你需要下载MultiWOZ2.1data/中然后对其进行解压,然后执行下述命令:

python data_analysis.py
python preprocess.py

此外,数据库文件也是需要的:

unzip db.zip

训练

nce方法训练

train_nce.py文件中为使用nce方法训练的代码,通过修改train_nce.sh来改变其参数。运行方式为:

bash train_nce.sh $GPU ${your_exp_name}

e.g.

bash train_nce.sh 0 DS-baseline

dnce方法训练

train_dnce.py文件中为使用dnce方法训练的代码,通过修改train_dnce.sh来改变其参数。运行方式为:

bash train_dnce.sh $GPU ${your_exp_name}

e.g.

bash train_dnce.sh 0 DS-baseline

residual方法训练

train_residual.py文件中为使用残差能量模型方法训练的代码,通过修改train_residual.sh来改变其参数。运行方式为:

bash train_residual.sh $GPU ${your_exp_name}

e.g.

bash train_residual.sh 0 DS-baseline

wyb_graduation's People

Contributors

wangyb18 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.