AI Center
最新
False
横幅背景图像
AI Center
上次更新日期 2024年4月18日

多语言文本分类

开箱即用包 > 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_namedataset.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, 9text, label
I like this movie, 7
I hated the acting, 9

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

  • dataset.input_format: auto
  • dataset.input_column_name: text
  • dataset.output_column_namelabel

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_namelabel

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_nameannotations.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_centerauto
    • 如果选择ai_center ,则仅支持JSON文件。 如果选择了ai_center ,请确保还将 dataset.target_column_name 的值更改为annotations.sentiment.choices
    • 如果选择auto ,则同时支持CoNLLJSON文件。
  • 模型.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     20000precision    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.98text,label,predict,confidence
I like this movie, positive, positive, 0.99
I hated the acting, negative, negative, 0.98

此页面是否有帮助?

获取您需要的帮助
了解 RPA - 自动化课程
UiPath Community 论坛
Uipath 白色徽标
信任与安全
© 2005-2024 UiPath. All rights reserved.