Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
2b201889
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
695
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
2b201889
编写于
11月 10, 2017
作者:
Y
Yang yaming
提交者:
GitHub
11月 10, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5542 from pkuyym/fix-5535
IndicateDataType --> GetKernelType
上级
7eacb306
3c84ebec
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
15 addition
and
14 deletion
+15
-14
paddle/operators/chunk_eval_op.cc
paddle/operators/chunk_eval_op.cc
+15
-14
未找到文件。
paddle/operators/chunk_eval_op.cc
浏览文件 @
2b201889
...
@@ -45,9 +45,10 @@ class ChunkEvalOp : public framework::OperatorWithKernel {
...
@@ -45,9 +45,10 @@ class ChunkEvalOp : public framework::OperatorWithKernel {
}
}
protected:
protected:
framework
::
DataType
IndicateData
Type
(
framework
::
OpKernelType
GetKernel
Type
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
return
framework
::
DataType
::
FP32
;
return
framework
::
OpKernelType
(
framework
::
DataType
::
FP32
,
ctx
.
device_context
());
}
}
};
};
...
@@ -82,12 +83,12 @@ class ChunkEvalOpMaker : public framework::OpProtoAndCheckerMaker {
...
@@ -82,12 +83,12 @@ class ChunkEvalOpMaker : public framework::OpProtoAndCheckerMaker {
"See below for details."
)
"See below for details."
)
.
SetDefault
(
std
::
vector
<
int
>
{});
.
SetDefault
(
std
::
vector
<
int
>
{});
AddComment
(
R"DOC(
AddComment
(
R"DOC(
For some basics of chunking, please refer to
For some basics of chunking, please refer to
‘Chunking with Support Vector Mechines <https://aclanthology.info/pdf/N/N01/N01-1025.pdf>’.
‘Chunking with Support Vector Mechines <https://aclanthology.info/pdf/N/N01/N01-1025.pdf>’.
CheckEvalOp computes the precision, recall, and F1-score of chunk detection,
CheckEvalOp computes the precision, recall, and F1-score of chunk detection,
and supports IOB, IOE, IOBES and IO (also known as plain) tagging schemes.
and supports IOB, IOE, IOBES and IO (also known as plain) tagging schemes.
Here is a NER example of labeling for these tagging schemes:
Here is a NER example of labeling for these tagging schemes:
Li Ming works at Agricultural Bank of China in Beijing.
Li Ming works at Agricultural Bank of China in Beijing.
...
@@ -96,17 +97,17 @@ Here is a NER example of labeling for these tagging schemes:
...
@@ -96,17 +97,17 @@ Here is a NER example of labeling for these tagging schemes:
IOE: I-PER E-PER O O I-ORG I-ORG I-ORG E-ORG O E-LOC
IOE: I-PER E-PER O O I-ORG I-ORG I-ORG E-ORG O E-LOC
IOBES: B-PER E-PER O O I-ORG I-ORG I-ORG E-ORG O S-LOC
IOBES: B-PER E-PER O O I-ORG I-ORG I-ORG E-ORG O S-LOC
There are three chunk types(named entity types) including PER(person), ORG(orgnazation)
There are three chunk types(named entity types) including PER(person), ORG(orgnazation)
and LOC(LOCATION), and we can see that the labels have the form <tag type>-<chunk type>.
and LOC(LOCATION), and we can see that the labels have the form <tag type>-<chunk type>.
Since the calculations actually use label ids rather than labels, extra attention
Since the calculations actually use label ids rather than labels, extra attention
should be paid when mapping labels to ids to make CheckEvalOp work. The key point
should be paid when mapping labels to ids to make CheckEvalOp work. The key point
is that the listed equations are satisfied by ids.
is that the listed equations are satisfied by ids.
tag_type = label % num_tag_type
tag_type = label % num_tag_type
chunk_type = label / num_tag_type
chunk_type = label / num_tag_type
where `num_tag_type` is the num of tag types in the tagging scheme, `num_chunk_type`
where `num_tag_type` is the num of tag types in the tagging scheme, `num_chunk_type`
is the num of chunk types, and `tag_type` get its value from the following table.
is the num of chunk types, and `tag_type` get its value from the following table.
Scheme Begin Inside End Single
Scheme Begin Inside End Single
...
@@ -115,7 +116,7 @@ is the num of chunk types, and `tag_type` get its value from the following table
...
@@ -115,7 +116,7 @@ is the num of chunk types, and `tag_type` get its value from the following table
IOE - 0 1 -
IOE - 0 1 -
IOBES 0 1 2 3
IOBES 0 1 2 3
Still use NER as example, assuming the tagging scheme is IOB while chunk types are ORG,
Still use NER as example, assuming the tagging scheme is IOB while chunk types are ORG,
PER and LOC. To satisfy the above equations, the label map can be like this:
PER and LOC. To satisfy the above equations, the label map can be like this:
B-ORG 0
B-ORG 0
...
@@ -126,9 +127,9 @@ PER and LOC. To satisfy the above equations, the label map can be like this:
...
@@ -126,9 +127,9 @@ PER and LOC. To satisfy the above equations, the label map can be like this:
I-LOC 5
I-LOC 5
O 6
O 6
It’s not hard to verify the equations noting that the num of chunk types
It’s not hard to verify the equations noting that the num of chunk types
is 3 and the num of tag types in IOB scheme is 2. For example, the label
is 3 and the num of tag types in IOB scheme is 2. For example, the label
id of I-LOC is 5, the tag type id of I-LOC is 1, and the chunk type id of
id of I-LOC is 5, the tag type id of I-LOC is 1, and the chunk type id of
I-LOC is 2, which consistent with the results from the equations.
I-LOC is 2, which consistent with the results from the equations.
)DOC"
);
)DOC"
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录