UiPath Documentation
ai-center
2022.10
false
AI Center 用户指南
重要 :
新发布内容的本地化可能需要 1-2 周的时间才能完成。

自定义命名实体识别

“开箱即用包”>“UiPath 语言分析”>“自定义命名实体识别”

此模型允许您导入自己标记有要提取的实体的数据集。训练数据集和评估数据集需要采用 CoNLL 或 JSON 格式。您也可以从AI Center数据标签工具或 Label Studio 导出数据。此 ML 包必须重新训练,如果在未事先进行训练的情况下部署此包,部署将失败,并显示错误,指明模型未经过训练。

For an example on how to use this model, check the Extracting chemicals from research paper by category page for a use case.

语言​

此多语言模型支持以下列表中的语言。之所以选择这些语言,是因为它们是维基百科条目数最多的前 100 种语言:

  • 南非荷兰语
  • 阿尔巴尼亚语
  • 阿拉伯语
  • 阿拉贡语
  • 亚美尼亚语
  • 阿斯图里亚斯语
  • 阿塞拜疆
  • 巴什基尔
  • 巴斯克语
  • 巴伐利亚语
  • 白俄罗斯语
  • 孟加拉语
  • 比什奴普莱利亚-曼尼浦尔语
  • 波斯尼亚语
  • 布列塔尼
  • 保加利亚语
  • 缅甸语
  • 加泰罗尼亚语
  • 宿务语
  • 车臣
  • 中文 (简体)
  • 中文 (繁体)
  • 楚瓦什语
  • 克罗地亚语
  • 捷克语
  • 丹麦语
  • 荷兰语
  • 英文
  • 爱沙尼亚语
  • 芬兰语
  • 法语
  • 加利西亚语
  • 格鲁吉亚语
  • 德语
  • 希腊语
  • 古吉拉特语
  • 海地语
  • 希伯来语
  • 印地语
  • 匈牙利语
  • 冰岛语
  • 伊多
  • 印尼语
  • 爱尔兰语
  • 意大利语
  • 日语
  • 爪哇语
  • 卡纳达语
  • 哈萨克语
  • 吉尔吉斯语
  • 韩语
  • 拉丁语
  • 拉脱维亚语
  • 立陶宛语
  • 伦巴第语
  • 低萨克森语
  • 卢森堡语
  • 马其顿语
  • 马达加斯加语
  • 马来语
  • 马拉雅拉姆语
  • 马拉地语
  • 米南卡保
  • 蒙古语
  • 尼泊尔语
  • 尼瓦尔语
  • 挪威博克马尔语
  • 挪威尼诺斯克语
  • 奥克西顿语
  • 波斯语(现代波斯语)
  • 皮埃蒙特语
  • 波兰语
  • 葡萄牙语
  • 旁遮普语
  • 罗马尼亚语
  • 俄语
  • 苏格兰语
  • 塞尔维亚语
  • 塞尔维亚语-克罗地亚语
  • 西西里岛人语
  • 斯洛伐克语
  • 斯洛文尼亚语
  • 南阿塞拜疆语
  • 西班牙语
  • 巽他语
  • 斯瓦希里语
  • 瑞典语
  • 他加禄语
  • 塔吉克语
  • 泰米尔语
  • 鞑靼人
  • 泰卢固语
  • 泰语
  • 土耳其语
  • 乌克兰语
  • 乌尔都语
  • 乌兹别克语
  • 越南语
  • 沃拉卜克语
  • 瓦瑞瓦瑞语
  • 威尔士语
  • 西弗里西亚语
  • 西部旁遮普语
  • 约鲁巴语

模型详细信息​

输入说明​

使用一种受支持语言的文本,将从中提取实体。

输出说明​

文本中命名实体的列表。列表中的每个元素在预测中都有以下项目:

  • 已识别的文本

  • 文本的开始位置和结束位置,按字符排列

  • 命名实体的类型

  • 可信度

    {
     "response" : [{
       "value": "George Washington",
       "start_index": 0,
       "end_index": 17,
       "entity": "PER",
       "confidence": 0.96469810605049133
      }]
    }
    {
     "response" : [{
       "value": "George Washington",
       "start_index": 0,
       "end_index": 17,
       "entity": "PER",
       "confidence": 0.96469810605049133
      }]
    }
    

推荐 GPU ​

默认情况下,建议使用 GPU。

管道​

此包支持所有三种类型的管道(完整训练、训练和评估)。对于大多数用例,不需要指定任何参数,模型将使用高级技术来查找高性能模型。在第一次训练之后的后续训练中,模型将使用增量学习(即,在训练运行结束后将使用先前训练的版本)。

使用来自验证站点的数据进行微调​

您可以使用Label Studio API 回写可信度较低的数据和预测。 然后,您可以重新标记数据,并以 CoNLL 格式导出数据。

For more information on how to use Label Studio, check the Getting started with Label Studio page. Also, you can download the UiPath® Studio activity for Label Studio Integration from the following URL UiPath Studio activity.

或者,您可以利用 AI Center 中的数据标签功能。

在 GPU 或 CPU 上训练​

您可以使用 GPU 或 CPU 进行训练。我们建议使用 GPU,因为它速度更快。

数据集格式​

此模型支持在所有管道运行(训练、评估和完整管道)期间读取给定目录中的所有文件。

备注:

确保标签名称不包含任何空格或特殊字符。 例如,使用SetDate代替Set Date }。

CoNLL 文件格式​

此模型可以使用提供的目录中的 CoNLL 文件格式读取扩展名为.txt和/或.conll的所有文件。

CoNLL 文件格式表示文本主体,每行包含一个单词,每个单词包含 10 个制表符分隔的列,其中包含有关该单词(例如,surface 和 syntax)的信息。

可训练的命名实体识别支持两种 CoNLL 格式:

  • 文本中只有两列。
  • 文本中有四列。

要使用此格式,请设置dataset.input_format 环境变量添加到conll或label_studio 。

备注:

label_studio格式与CoNLL格式相同,两个数据点之间的分隔符是一个新的空行。 要支持使用-DOCSTART- -X- O O分隔两个数据点,请添加dataset.input_format作为环境变量,并将其值设置为conll 。

有关更多信息,请查看以下示例:

Japan NNP B-NP B-LOC
began VBD B-VP O
the DT B-NP O
defence NN I-NP O
of IN B-PP O
their PRP$ B-NP O
Asian JJ I-NP B-MISC
Cup NNP I-NP I-MISC
title NN I-NP O
with IN B-PP O
a DT B-NP O
lucky JJ I-NP O
2-1 CD I-NP O
win VBP B-VP O
against IN B-PP O
Syria NNP B-NP B-LOC
in IN B-PP O
a DT B-NP O
Group NNP I-NP O
C NNP I-NP O
championship NN I-NP O
match NN I-NP O
on IN B-PP O
Friday NNP B-NP O
. . O OFounding O
member O
Kojima B-PER
Minoru I-PER
played O
guitar O
on O
Good B-MISC
Day I-MISC
, O
and O
Wardanceis I-MISC
cover O
of O
a O
song O
by O
UK I-LOC
post O
punk O
industrial O
band O
Killing B-ORG
Joke I-ORG
. O
Japan NNP B-NP B-LOC
began VBD B-VP O
the DT B-NP O
defence NN I-NP O
of IN B-PP O
their PRP$ B-NP O
Asian JJ I-NP B-MISC
Cup NNP I-NP I-MISC
title NN I-NP O
with IN B-PP O
a DT B-NP O
lucky JJ I-NP O
2-1 CD I-NP O
win VBP B-VP O
against IN B-PP O
Syria NNP B-NP B-LOC
in IN B-PP O
a DT B-NP O
Group NNP I-NP O
C NNP I-NP O
championship NN I-NP O
match NN I-NP O
on IN B-PP O
Friday NNP B-NP O
. . O OFounding O
member O
Kojima B-PER
Minoru I-PER
played O
guitar O
on O
Good B-MISC
Day I-MISC
, O
and O
Wardanceis I-MISC
cover O
of O
a O
song O
by O
UK I-LOC
post O
punk O
industrial O
band O
Killing B-ORG
Joke I-ORG
. O
JSON 文件格式​

可以设置环境变量,此模型将使用 JSON 格式读取所提供目录中的所有文件,该目录具有.json扩展名。

检查以下示例和环境变量以获取JSON 文件格式示例。

{
    "text": "Serotonin receptor 2A ( HTR2A ) gene polymorphism predicts treatment response to venlafaxine XR in generalized anxiety disorder . anxiety disorder ( GAD ) is a chronic psychiatric disorder with significant morbidity and mortality .\)
Antidepressant drugs are the preferred choice for treatment ; however , treatment response is often variable .\)
Several studies in major depression have implicated a role of the serotonin receptor gene ( HTR2A ) in treatment response to antidepressants .\)
We tested the hypothesis that the genetic polymorphism rs7997012 in the HTR2A gene predicts treatment outcome in GAD patients treated with venlafaxine XR . Treatment response was assessed in 156 patients that participated in a 6-month open - label clinical trial of venlafaxine XR for GAD . Primary analysis included Hamilton Anxiety Scale ( HAM-A ) reduction at 6 months .\)
Secondary outcome measure was the Clinical Global Impression of Improvement ( CGI-I ) score at 6 months .\)
Genotype and allele frequencies were compared between groups using χ(2) contingency analysis .\)
The frequency of the G-allele differed significantly between responders ( 70% ) and nonresponders ( 56% ) at 6 months ( P=0.05 ) using the HAM-A scale as outcome measure .\)
Similarly , using the CGI-I as outcome , the G-allele was significantly associated with improvement ( P=0.01 ) .\)
Assuming a dominant effect of the G-allele , improvement differed significantly between groups ( P=0.001 , odds ratio=4.72 ) .\)
Similar trends were observed for remission although not statistically significant .\)
We show for the first time a pharmacogenetic effect of the HTR2A rs7997012 variant in anxiety disorders , suggesting that pharmacogenetic effects cross diagnostic categories .\)
Our data document that individuals with the HTR2A rs7997012 single nucleotide polymorphism G-allele have better treatment outcome over time .\)
Future studies with larger sample sizes are necessary to further characterize this effect in treatment response to antidepressants in GAD .",
    "entities": [{
        "entity": "TRIVIAL",
        "value": "Serotonin",
        "start_index": 0,
        "end_index": 9
    }, {
        "entity": "TRIVIAL",
        "value": "venlafaxine",
        "start_index": 81,
        "end_index": 92
    }, {
        "entity": "TRIVIAL",
        "value": "serotonin",
        "start_index": 409,
        "end_index": 418
    }, {
        "entity": "TRIVIAL",
        "value": "venlafaxine",
        "start_index": 625,
        "end_index": 636
    }, {
        "entity": "TRIVIAL",
        "value": "venlafaxine",
        "start_index": 752,
        "end_index": 763
    }, {
        "entity": "FAMILY",
        "value": "nucleotide",
        "start_index": 1800,
        "end_index": 1810
    }]
}
{
    "text": "Serotonin receptor 2A ( HTR2A ) gene polymorphism predicts treatment response to venlafaxine XR in generalized anxiety disorder . anxiety disorder ( GAD ) is a chronic psychiatric disorder with significant morbidity and mortality .\)
Antidepressant drugs are the preferred choice for treatment ; however , treatment response is often variable .\)
Several studies in major depression have implicated a role of the serotonin receptor gene ( HTR2A ) in treatment response to antidepressants .\)
We tested the hypothesis that the genetic polymorphism rs7997012 in the HTR2A gene predicts treatment outcome in GAD patients treated with venlafaxine XR . Treatment response was assessed in 156 patients that participated in a 6-month open - label clinical trial of venlafaxine XR for GAD . Primary analysis included Hamilton Anxiety Scale ( HAM-A ) reduction at 6 months .\)
Secondary outcome measure was the Clinical Global Impression of Improvement ( CGI-I ) score at 6 months .\)
Genotype and allele frequencies were compared between groups using χ(2) contingency analysis .\)
The frequency of the G-allele differed significantly between responders ( 70% ) and nonresponders ( 56% ) at 6 months ( P=0.05 ) using the HAM-A scale as outcome measure .\)
Similarly , using the CGI-I as outcome , the G-allele was significantly associated with improvement ( P=0.01 ) .\)
Assuming a dominant effect of the G-allele , improvement differed significantly between groups ( P=0.001 , odds ratio=4.72 ) .\)
Similar trends were observed for remission although not statistically significant .\)
We show for the first time a pharmacogenetic effect of the HTR2A rs7997012 variant in anxiety disorders , suggesting that pharmacogenetic effects cross diagnostic categories .\)
Our data document that individuals with the HTR2A rs7997012 single nucleotide polymorphism G-allele have better treatment outcome over time .\)
Future studies with larger sample sizes are necessary to further characterize this effect in treatment response to antidepressants in GAD .",
    "entities": [{
        "entity": "TRIVIAL",
        "value": "Serotonin",
        "start_index": 0,
        "end_index": 9
    }, {
        "entity": "TRIVIAL",
        "value": "venlafaxine",
        "start_index": 81,
        "end_index": 92
    }, {
        "entity": "TRIVIAL",
        "value": "serotonin",
        "start_index": 409,
        "end_index": 418
    }, {
        "entity": "TRIVIAL",
        "value": "venlafaxine",
        "start_index": 625,
        "end_index": 636
    }, {
        "entity": "TRIVIAL",
        "value": "venlafaxine",
        "start_index": 752,
        "end_index": 763
    }, {
        "entity": "FAMILY",
        "value": "nucleotide",
        "start_index": 1800,
        "end_index": 1810
    }]
}

上一个示例的环境变量如下:

  • dataset.input_format : json
  • dataset.input_column_name : text
  • 数据集.输出列名称: entities
ai_center 文件格式​

这是默认格式,也是 AI Center 中数据标签工具的导出格式,此模型将读取所提供目录中的所有文件,扩展名为.json 。

检查以下示例和环境变量,以获取 ai_center 文件格式示例。

{
    "annotations": {
        "intent": {
            "to_name": "text",
            "choices": [
                "TransactionIssue",
                "LoanIssue"
            ]
        },
        "sentiment": {
            "to_name": "text",
            "choices": [
                "Very Positive"
            ]
        },
        "ner": {
            "to_name": "text",
            "labels": [
                {
                    "start_index": 37,
                    "end_index": 47,
                    "entity": "Stakeholder",
                    "value": " Citi Bank"
                },
                {
                    "start_index": 51,
                    "end_index": 61,
                    "entity": "Date",
                    "value": "07/19/2018"
                },
                {
                    "start_index": 114,
                    "end_index": 118,
                    "entity": "Amount",
                    "value": "$500"
                },
                {
                    "start_index": 288,
                    "end_index": 293,
                    "entity": "Stakeholder",
                    "value": " Citi"
                }
            ]
        }
    },
    "data": {
        "cc": "",
        "to": "xyz@abc.com",
        "date": "1/29/2020 12:39:01 PM",
        "from": "abc@xyz.com",
        "text": "I opened my new checking account with Citi Bank in 07/19/2018 and met the requirements for the promotion offer of $500 . It has been more than 6 months and I have not received any bonus. I called the customer service several times in the past few months but no any response. I request the Citi honor its promotion offer as advertised."
    }
}
{
    "annotations": {
        "intent": {
            "to_name": "text",
            "choices": [
                "TransactionIssue",
                "LoanIssue"
            ]
        },
        "sentiment": {
            "to_name": "text",
            "choices": [
                "Very Positive"
            ]
        },
        "ner": {
            "to_name": "text",
            "labels": [
                {
                    "start_index": 37,
                    "end_index": 47,
                    "entity": "Stakeholder",
                    "value": " Citi Bank"
                },
                {
                    "start_index": 51,
                    "end_index": 61,
                    "entity": "Date",
                    "value": "07/19/2018"
                },
                {
                    "start_index": 114,
                    "end_index": 118,
                    "entity": "Amount",
                    "value": "$500"
                },
                {
                    "start_index": 288,
                    "end_index": 293,
                    "entity": "Stakeholder",
                    "value": " Citi"
                }
            ]
        }
    },
    "data": {
        "cc": "",
        "to": "xyz@abc.com",
        "date": "1/29/2020 12:39:01 PM",
        "from": "abc@xyz.com",
        "text": "I opened my new checking account with Citi Bank in 07/19/2018 and met the requirements for the promotion offer of $500 . It has been more than 6 months and I have not received any bonus. I called the customer service several times in the past few months but no any response. I request the Citi honor its promotion offer as advertised."
    }
}

为了利用前面的示例 JSON,需要按如下方式设置环境变量:

  • dataset.input_format到ai_center
  • 将dataset.input_column_name更改为data.text
  • 将dataset.output_column_name更改为annotations.ner.labels

环境变量​

  • dataset.input_column_name
    • 包含文本的列的名称。
    • 默认值为 data.text。
    • 仅当输入文件格式为ai_center或JSON时,才需要此变量。
  • dataset.target_column_name
    • 包含标签的列的名称。
    • 默认值为 annotations.ner.labels。
    • 仅当输入文件格式为ai_center或JSON时,才需要此变量。
  • 模型.epochs
    • 时期数。
    • 默认值为 5。
  • dataset.input_format
    • 训练数据的输入格式。

    • 默认值为 ai_center。

    • 支持的值包括: ai_center 、 conll 、 label_studio或json 。

      备注:

      label_studio格式与CoNLL格式相同,两个数据点之间的分隔符是一个新的空行。 要支持使用-DOCSTART- -X- O O分隔两个数据点,请添加dataset.input_format作为环境变量,并将其值设置为conll 。

工件​

工件包含以下内容:

  • 评估报告,包含以下文件:
    • 分类报告
    • 混淆矩阵
    • 精确召回信息
  • JSON 文件:单独的 JSON 文件,与评估报告 PDF 文件的每个部分相对应。这些 JSON 文件可供计算机读取,所以您可以使用它们通过工作流将模型评估传输到 Insights 中。
分类报告​

运行完整管道或评估管道时,分类报告来自测试数据集。 它以图表的形式包含每个实体的以下信息:

  • 实体 - 实体的名称。

  • “精度” - 用于在测试集上正确预测实体的精度指标。

  • 召回率 - 在测试集上正确预测实体的召回率指标。

  • F1 分数 - 用于在测试集上正确预测实体的 f1 分数指标;您可以使用此分数来比较此模型的两个不同训练版本的基于实体的性能。

混淆矩阵​

混淆矩阵下还提供了一个表格,其中包含对不同类别错误的解释。每个实体的错误类别包括正确、不正确、缺失和错误,并在该表中进行了说明。

精确召回信息​

您可以使用此信息来检查模型的精度和召回率。 图表上方的表格还提供了每个实体的阈值以及相应的精度和召回率值。 此表将允许您选择要在工作流中配置的所需阈值,以便决定何时将数据发送到Action Center for human in loop。 请注意,所选阈值越高,循环中路由到 Action Center for human in 循环的数据量就越多。

每个实体都有一个精确召回率图表和表格。

有关每个实体的精度召回表示例,请查看下表:

阈值精度召回
0.50.91930.979
0.550.92240.9777
0.60.92340.9771
0.650.92560.9771
0.70.92770.9759
0.750.93190.9728
0.80.93560.9697
0.850.94120.9697
0.90.94840.9666
0.950.9570.9629

有关每个实体的精度召回率图的示例,请查看下图:

数据​

评估 CSV 文件​

这是一个 CSV 文件,其中包含对用于评估的测试集的预测。 该文件包含以下列:

  • “文本” - 用于评估的文本。
  • “实际实体” - 在评估数据集中作为标记数据提供的实体。
  • “Predicted_entities” - 已训练模型预测的实体。
  • Error_type_counts - 按错误类型分类的实际实体和预测实体之间的差异。

此页面有帮助吗?

连接

需要帮助? 支持(opens in new window)

想要了解详细内容? UiPath Academy(opens in new window)

有问题? UiPath 论坛(opens in new window)

保持更新