- 发行说明
- 在开始之前
- 入门指南
- 项目
- 数据集
- ML 包
- 管道
- ML 技能
- ML 日志
- AI Center 中的 Document Understanding
- 如何
- 基本故障排除指南

AI Center 用户指南
开箱即用包 > UiPath 语言分析 > 多语言文本分类
这是用于文本分类的通用、可重训练模型。 必须训练此 ML 包,如果在未训练的情况下进行部署,则部署将失败,并显示错误,指出模型未训练。 它基于 BERT,这是一种用于预训练自然语言处理系统的自我监督方法。 建议使用 GPU,尤其是在训练期间。 GPU 可将速度提高约 5 到 10 倍。
此多语言模型支持下面列出的语言。之所以选择这些语言,是因为它们是维基百科条目数最多的前 100 种语言:
- 南非荷兰语
- 阿尔巴尼亚语
- 阿拉伯语
- 阿拉贡语
- 亚美尼亚语
- 阿斯图里亚斯语
- 阿塞拜疆
- 巴什基尔
- 巴斯克语
- 巴伐利亚语
- 白俄罗斯语
- 孟加拉语
- 比什奴普莱利亚-曼尼浦尔语
- 波斯尼亚语
- 布列塔尼
- 保加利亚语
- 缅甸语
- 加泰罗尼亚语
- 宿务语
- 车臣
- 中文 (简体)
- 中文 (繁体)
- 楚瓦什语
- 克罗地亚语
- 捷克语
- 丹麦语
- 荷兰语
- 英文
- 爱沙尼亚语
- 芬兰语
- 法语
- 加利西亚语
- 格鲁吉亚语
- 德语
- 希腊语
- 古吉拉特语
- 海地语
- 希伯来语
- 印地语
- 匈牙利语
- 冰岛语
- 伊多
- 印尼语
- 爱尔兰语
- 意大利语
- 日语
- 爪哇语
- 卡纳达语
- 哈萨克语
- 吉尔吉斯语
- 韩语
- 拉丁语
- 拉脱维亚语
- 立陶宛语
- 伦巴第语
- 低萨克森语
- 卢森堡语
- 马其顿语
- 马达加斯加语
- 马来语
- 马拉雅拉姆语
- 马拉地语
- 米南卡保
- 尼泊尔语
- 尼瓦尔语
- 挪威博克马尔语
- 挪威尼诺斯克语
- 奥克西顿语
- 波斯语(现代波斯语)
- 皮埃蒙特语
- 波兰语
- 葡萄牙语
- 旁遮普语
- 罗马尼亚语
- 俄语
- 苏格兰语
- 塞尔维亚语
- 塞尔维亚语-克罗地亚语
- 西西里岛人语
- 斯洛伐克语
- 斯洛文尼亚语
- 南阿塞拜疆语
- 西班牙语
- 巽他语
- 斯瓦希里语
- 瑞典语
- 他加禄语
- 塔吉克语
- 泰米尔语
- 鞑靼人
- 泰卢固语
- 泰语
- 土耳其语
- 乌克兰语
- 乌尔都语
- 乌兹别克语
- 越南语
- 沃拉卜克语
- 瓦瑞瓦瑞语
- 威尔士语
- 西弗里西亚语
- 西部旁遮普语
- 约鲁巴语
输入类型
JSON
输入说明
要分类为字符串的文本:“I loved this movie”。
输出说明
包含预测类名称以及有关该类预测的关联置信度(0 到 1)的 JSON。
示例:
{
"prediction": "Positive",
"confidence": 0.9422031841278076
}
{
"prediction": "Positive",
"confidence": 0.9422031841278076
}
推荐 GPU
默认情况下,建议使用 GPU。
已启用训练
默认情况下启用训练。
此包支持所有三种类型的管道(完整训练、训练和评估)。对于大多数用例,不需要指定任何参数,模型将使用高级技术来查找高性能模型。在第一次训练之后的后续训练中,模型将使用增量学习(即,在训练运行结束后将使用先前训练的版本)。
数据集格式
有三个选项可用于构建此模型的数据集:JSON、CSV 和AI Center JSON 格式。 模型将读取指定目录中的所有 CSV 和 JSON 文件。 对于每种格式,模型都需要两个列或两个属性, dataset.input_column_name 和dataset.target_column_name 默认情况下。 这两个列和/或目录的名称可以使用环境变量进行配置。
CSV 文件格式
每个 CSV 文件可以有任意数量的列,但模型只会使用两个列。 这些列由 dataset.input_column_name 指定和 dataset.target_column_name 参数。
检查以下示例和环境变量以获取 CSV 文件格式示例。
text, label
I like this movie, 7
I hated the acting, 9
text, label
I like this movie, 7
I hated the acting, 9
上一个示例的环境变量如下:
- dataset.input_format:
auto
- dataset.input_column_name:
text
- dataset.output_column_name:
label
JSON 文件格式
多个数据点可能属于同一个 JSON 文件。
检查以下示例和环境变量以获取 JSON 文件格式示例。
[
{
"text": "I like this movie",
"label": "7"
},
{
"text": "I hated the acting",
"label": "9"
}
]
[
{
"text": "I like this movie",
"label": "7"
},
{
"text": "I hated the acting",
"label": "9"
}
]
上一个示例的环境变量如下:
- dataset.input_format:
auto
- dataset.input_column_name:
text
- dataset.output_column_name:
label
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.intent.choices
在 GPU 或 CPU 上训练
您可以使用 GPU 或 CPU 进行训练。我们建议使用 GPU,因为它速度更快。
环境变量
- dataset.input_column_name
- 包含文本的输入列的名称。
- 默认值为
data.text
。 - 确保根据输入的 JSON 或 CSV 文件配置此变量。
- dataset.target_column_name
- 包含文本的目标列的名称。
- 默认值为
annotations.intent.choices
。 - 确保根据输入的 JSON 或 CSV 文件配置此变量。
- dataset.input_format
- 训练数据的输入格式。
- 默认值为
ai_center
。 - 支持的值为:
ai_center
或auto
。 - 如果选择
ai_center
,则仅支持JSON
文件。 如果选择了ai_center
,请确保还将 dataset.target_column_name 的值更改为annotations.sentiment.choices
。 - 如果选择
auto
,则同时支持CoNLL
和JSON
文件。
- 模型.epochs
- 时期数。
- 默认值:
100
。
工件
混淆矩阵
分类报告
precision recall f1-score support
positive 0.94 0.94 0.94 10408
negative 0.93 0.93 0.93 9592
accuracy 0.94 20000
macro avg 0.94 0.94 0.94 20000
weighted avg 0.94 0.94 0.94 20000
precision recall f1-score support
positive 0.94 0.94 0.94 10408
negative 0.93 0.93 0.93 9592
accuracy 0.94 20000
macro avg 0.94 0.94 0.94 20000
weighted avg 0.94 0.94 0.94 20000
数据
评估 CSV 文件
这是一个 CSV 文件,其中包含用于评估的测试集的预测。
text,label,predict,confidence
I like this movie, positive, positive, 0.99
I hated the acting, negative, negative, 0.98
text,label,predict,confidence
I like this movie, positive, positive, 0.99
I hated the acting, negative, negative, 0.98