# NeAt-Vision
> NeAt (Neural Attention) Vision, is a visualization tool
for the attention mechanisms of deep-learning models
for Natural Language Processing (NLP) tasks.
#### Features
- Visualize the attention scores, with lots of options.
- Export the visualization to SVG format. This is very convenient if you
want to use the visualization in an academic paper. However, you may have
to convert the SVG to PDF.
- Visualize the models predictions. Show the posterior distribution over the
classes, the error in regression tasks and more. Useful for debugging your
models and inspecting their behavior.
- Support for classification, multilabel classification and regression.
_neat-vision_ is made for visualizing the weights of attention mechanisms
for Natural Language Processing (Tasks) tasks.
At this moment, _neat-vision_ only supports the visualization of
self-attention mechanisms, operating on the sentence-level
and for the following tasks:
- Regression: predict a single continuous value.
- Multi-class Classification: a classification task with more than two classes.
Each sample belongs to one of `N` classes.
- Multi-label Classification: we have `N` classes
and each sample may belong to more than one classes.
Essentially, it is a binary classification task for each class.
However in the future there are plans for
supporting document-level models (hierarchical) and seq2seq models,
such as in Neural Machine Translation (NMT).
**Website (live)**: https://cbaziotis.github.io/neat-vision/
<p style="text-align:center;">
<img src="./static/video.gif" alt="demo" style="width: 800px; max-width=100%;"/>
</p>
## Documentation
### Overview
_neat-vision_ takes as input 2 kinds of `json` files:
- **Data file**. This file contains (1) the text (tokenized),
(2) the attention scores and (3) the models predictions.
- **Label file** (optional).
This is needed only in classifications tasks
and if provided, it is used for mapping each class label
to a user-defined description.
### Input Format
Here you will find a detailed overview of
how to properly format the output files, for each task.
Besides the necessary data needed for visualizing the attention weights,
in _neat-vision_ you can also visualise the predictions of the model
and gain insights in its behavior. However, it is not required that you provide
such data (e.g. posterior probabilities).
In any case, in `\samples` you will find some examples,
containing the predictions of our team (NTUA-SLP) in Semeval 2018.
You can use them to test _neat-vision_ and to check the format of the data files.
**Notes**
- the posteriors don't have to be normalized, which means you can simply
use the logits (before the softmax). _neat-vision_ will normalize the logits
for you. This is convenient for PyTorch users.
- its ok to include the zero padded attention weights.
It simply matches each token with the corresponding attention weight,
so the zero padded timesteps in the attention weigths don't matter.
#### Regression
The structure of the data file for a classification task is the following:
```
{
"text": [], \\ list of strings - the tokens (words, chars) in the text. (required)
"label": 0, \\ float - the actual value. (required)
"prediction": 0, \\ float - the predicted value. (required)
"attention": [], \\ list of floats - the attention weigths. (required)
"id": "sample_11" \\ string - a unique id assigned to each sample. (required)
}
```
Here is an example of a sample in a data file:
```
{
"text": [
"i",
"have",
"never",
"been",
"so",
"excited",
"to",
"start",
"a",
"semester",
"!"
],
"label": 0.969,
"prediction": 0.8037105202674866,
"attention": [
0.030253062024712563,
0.04317276179790497,
0.12440750747919083,
0.018600208684802055,
0.023923002183437347,
0.1299467384815216,
0.1300467699766159,
0.13003277778625488,
0.1280088871717453,
0.1151493638753891,
0.12645892798900604,
0.0,
0.0,
...
0.0,
0.0
],
"id": "sample_11"
}
```
#### Classification
The structure of the data file for a classification task is the following:
```
{
"text": [], \\ list of strings - the tokens (words, chars) in the text. (required)
"label": 0, \\ integer - the class label. (required)
"prediction": 0, \\ integer - the predicted label. (required)
"posterior": [], \\ list of floats - the posterior probabilities. (optional)
"attention": [], \\ list of floats - the attention weigths. (required)
"id": "sample_99" \\ string - a unique id assigned to each sample. (required)
}
```
Here is an example of a sample in a data file:
```
{
"text": [
"20",
"episodes",
"left",
"i",
"am",
"dying",
"over",
"here"
],
"label": 0,
"prediction": 0,
"posterior": [
1.6511023044586182,
0.6472567319869995,
0.10215002298355103,
-1.8493231534957886
],
"attention": [
0.026811618357896805,
0.03429250791668892,
0.16327856481075287,
0.1225932389497757,
0.14799638092517853,
0.17938685417175293,
0.15541180968284607,
0.1702289879322052,
0.0,
0.0,
...
0.0,
0.0
],
"id": "sample_99"
}
```
#### Multilabel Classification
The structure of the data file for a classification task is the following:
```
{
"text": [], \\ list of strings - the tokens (words, chars) in the text. (required)
"label": 0, \\ list of ints - the class labels - binary vector. (required)
"prediction": 0, \\ list of ints - the predicted labels - binary vector. (required)
"posterior": [], \\ list of floats - the posterior probabilities. (optional)
"attention": [], \\ list of floats - the attention weigths. (required)
"id": "sample_55" \\ string - a unique id assigned to each sample. (required)
}
```
Here is an example of a sample in a data file:
```
{
"text": [
"<allcaps>",
"fall",
"season",
"starts",
"today",
"</allcaps>",
"!",
"<repeated>"
],
"label": [
0,
1,
0,
0,
1,
0,
1,
0,
0,
0,
1
],
"prediction": [
0,
1,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
"posterior": [
-2.388745069503784,
0.4522533118724823,
-3.0336408615112305,
-2.2636921405792236,
1.1948155164718628,
-2.710108995437622,
-0.09358435124158859,
-3.7859573364257812,
-3.229905605316162,
-2.832045078277588,
-2.1722922325134277
],
"attention": [
0.12348131835460663,
0.12422706931829453,
0.12277955561876297,
0.14215923845767975,
0.12141828238964081,
0.12250666320323944,
0.12207339704036713,
0.12135452032089233,
0.0,
0.0,
...
0.0,
0.0
],
"id": "sample_55"
}
```
##### Labels
In classification tasks, you can optionally provide a mapping
of each class label to a name and description. Here is such an example:
```json
{
"0": {
"name": "â¤",
"desc": "_red_heart_"
},
"1": {
"name": "ð",
"desc": "_smiling_face_with_hearteyes_"
},
"2": {
"name": "ð",
"desc": "_face_with_tears_of_joy_"
},
"3": {
"name": "ð",
"desc": "_two_hearts_"
},
"4": {
"name": "ð¥",
"desc": "_fire_"
},
"5": {
"name": "ð",
"desc": "_smiling_face_with_smiling_eyes_"
},
"6": {
"name": "ð",
"desc": "_smiling_face_with_sunglasses_"
},
"7": {
"name": "â¨",
"desc": "_sparkles_"
},
"8": {
"name": "ð",
"desc": "_blue_heart_"
},
"9": {
没有合适的资源?快使用搜索试试~ 我知道了~
整洁的视觉效果:Neat(Neural Attention)Vision是一种可视化工具,用于自然语言处理(NLP)任务的深度学...
共140个文件
png:62个
json:31个
js:18个
5星 · 超过95%的资源 需积分: 48 13 下载量 166 浏览量
2021-02-03
18:23:39
上传
评论
收藏 13.58MB ZIP 举报
温馨提示
网络视觉 NeAt(Neural Attention)Vision是一种可视化工具,用于自然语言处理(NLP)任务的深度学习模型的注意力机制。 产品特点 可视化注意力得分,有很多选择。 将可视化文件导出为SVG格式。 如果要在学术论文中使用可视化效果,这将非常方便。 但是,您可能必须将SVG转换为PDF。 可视化模型预测。 显示类的后验分布,回归任务中的错误等。 对于调试模型和检查其行为很有用。 支持分类,多标签分类和回归。 进行了整齐的可视化,以可视化自然语言处理(任务)任务的注意机制的权重。 目前,整洁的视觉只支持可视化的自我注意机制,在句子级别上执行以下任务: 回归:预测单个连
资源详情
资源评论
资源推荐
收起资源包目录
整洁的视觉效果:Neat(Neural Attention)Vision是一种可视化工具,用于自然语言处理(NLP)任务的深度学习模型的注意力机制。 (与框架无关) (140个子文件)
.babelrc 230B
app.b62184445eb725fe71e0eb8038c97003.css 169KB
simple-sidebar.css 2KB
.editorconfig 147B
fontawesome-webfont.674f50d.eot 162KB
.eslintignore 30B
video.gif 4.94MB
.gitignore 154B
.gitkeep 0B
.gitkeep 0B
index.html 628B
index.html 344B
vendor.e85f124cb76d96459df4.js 307KB
app.ebf91f34c8a8c83a3ae8.js 25KB
twemoji.min.js 10KB
webpack.prod.conf.js 5KB
webpack.dev.conf.js 3KB
utils.js 3KB
webpack.base.conf.js 2KB
index.js 2KB
check-versions.js 1KB
build.js 1KB
main.js 1KB
manifest.2ae2e69a05c33dfc65f8.js 857B
ml.js 825B
.eslintrc.js 791B
vue-loader.conf.js 553B
.postcssrc.js 246B
dev.env.js 156B
prod.env.js 61B
ntua-slp_semeval2018_task3_b_char_gold.json 1.41MB
ntua-slp_semeval2018_task3_b_char_train.json 1.35MB
ntua-slp_semeval2018_task1_e-c_dev.json 934KB
ntua-slp_semeval2018_task3_b_train.json 665KB
ntua-slp_semeval2018_task1_e-c_gold.json 572KB
ntua-slp_semeval2018_task1_e-c_train.json 563KB
ntua-slp_semeval2018_task2_a_test.json 562KB
ntua-slp_semeval2018_task2_a_trial.json 529KB
ntua-slp_semeval2018_task2_a_train.json 528KB
ntua-slp_semeval2018_task3_b_gold.json 498KB
ntua-slp_semeval2018_task3b_gold.json 498KB
ntua-slp_semeval2018_task1_ei-reg_sadness_train.json 475KB
ntua-slp_semeval2018_task1_ei-reg_fear_train.json 472KB
ntua-slp_semeval2018_task1_ei-reg_joy_gold.json 470KB
ntua-slp_semeval2018_task1_ei-reg_anger_gold.json 461KB
ntua-slp_semeval2018_task1_ei-reg_joy_train.json 453KB
ntua-slp_semeval2018_task1_ei-reg_fear_gold.json 452KB
ntua-slp_semeval2018_task1_ei-reg_sadness_gold.json 441KB
ntua-slp_semeval2018_task3b_train.json 440KB
ntua-slp_semeval2018_task1_ei-reg_anger_train.json 429KB
ntua-slp_semeval2018_task1_ei-reg_joy_dev.json 419KB
package-lock.json 404KB
ntua-slp_semeval2018_task1_ei-reg_sadness_dev.json 387KB
ntua-slp_semeval2018_task1_ei-reg_fear_dev.json 380KB
ntua-slp_semeval2018_task1_ei-reg_anger_dev.json 377KB
package.json 2KB
labels_task2.json 1KB
labels_task1_e-c.json 1006B
labels_task1_v-oc.json 449B
labels_task3_b.json 305B
labels_task1_ei-oc.json 265B
LICENSE 1KB
vendor.e85f124cb76d96459df4.js.map 1.39MB
app.b62184445eb725fe71e0eb8038c97003.css.map 283KB
app.ebf91f34c8a8c83a3ae8.js.map 99KB
manifest.2ae2e69a05c33dfc65f8.js.map 5KB
README.md 9KB
task2-06.png 53KB
task2-05.png 43KB
task2-12.png 40KB
task2-22.png 38KB
task2-10.png 38KB
task2-38.png 37KB
task2-41.png 36KB
task2-02.png 36KB
task2-14.png 36KB
task2-18.png 36KB
task2-20.png 36KB
task2-08.png 36KB
task2-24.png 35KB
task2-32.png 35KB
task2-28.png 34KB
task2-43.png 34KB
task2-16.png 34KB
task2-36.png 34KB
task2-34.png 33KB
task2-30.png 33KB
task2-26.png 32KB
task2-21.png 30KB
task2-11.png 29KB
task2-09.png 29KB
task2-37.png 29KB
task2-13.png 29KB
task2-40.png 28KB
task2-01.png 28KB
task2-07.png 28KB
task2-31.png 27KB
task2-15.png 27KB
task2-23.png 27KB
task2-27.png 27KB
共 140 条
- 1
- 2
一行一诚
- 粉丝: 20
- 资源: 4559
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1