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

浅色文本分类

“开箱即用包”>“UiPath 语言分析”>“浅色文本分类”

这是用于文本分类的通用、可重训练模型。 它支持基于拉丁字符的所有语言,例如英语、法语、西班牙语等。 必须训练此 ML 包,如果在未训练的情况下进行部署,则部署将失败,并显示错误,指出模型未训练。 此模型在词袋上运行。 此模型提供基于 n-gram 的可解释性。

模型详细信息

输入类型

JSON 和 CSV

输入说明

要分类为字符串的文本:“I loved this movie”。

输出说明

具有类别和置信度的 JSON(介于 0 到 1 之间)。

{
    "class": "7",
    "confidence": 0.1259827300369445,
    "ngrams": [
        [
            "like",
            1.3752658445706787
        ],
        [
            "like this",
            0.032029048484416685
        ]
    ]
}{
    "class": "7",
    "confidence": 0.1259827300369445,
    "ngrams": [
        [
            "like",
            1.3752658445706787
        ],
        [
            "like this",
            0.032029048484416685
        ]
    ]
}

推荐 GPU

不需要使用 GPU。

已启用训练

默认情况下启用训练。

管道

此包支持所有三种类型的管道(完整训练、训练和评估)。 该模型使用高级技术通过超参数搜索来查找高性能模型。 默认情况下,超参数搜索( BOW.hyperparameter_search.enable 变量)处于启用状态。 评估报告中提供了性能最高的模型的参数。

数据集格式

有三个选项可用于构建此模型的数据集: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.target_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.target_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.target_column_nameannotations.intent.choices

在 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文件。
  • BOW.hyperparameter_search.enable
    • 此参数的默认值为True 。 如果保持启用状态,这将在给定的时间范围内找到性能最高的模型和计算资源。
    • 这还将生成HyperparameterSearch_report PDF 文件,以展示已尝试的参数变体。
  • BOW.hyperparameter_search.timeout
    • 允许运行超参数搜索的最长时间 (以秒为单位)。
    • 默认值为 1800
  • BOW.explain_inference
    • 如果将其设置为True ,则在将模型用作 ML 技能的推理期间,一些最重要的 n-gram 也将与预测一起返回。
    • 默认值为 False

可选变量

您可以通过单击“ 添加新 ”按钮来添加其他可选变量。 但是,如果将 BOW.hyperparameter_search.enable 变量设置为True ,则会搜索这些变量的最佳值。 对于模型要使用的以下可选参数,请将 BOW.hyperparameter_search.enable 搜索变量设置为False
  • BOW.lr_kwargs.class_weight
    • 支持的值为: balancedNone
  • BOW.ngram_range
    • 可被视为模型特征的连续单词序列的序列长度范围。
    • 请务必遵循以下格式: (1, x) ,其中x是您要允许的最大序列长度。
  • BOW.min_df
    • 用于设置要视为特征的数据集中 n-gram 的最小出现次数。
    • 建议的值介于010之间。
  • dataset.text_pp_remove_stop_words
    • 用于配置是否应在搜索中包含停用词(例如, theor等词)。
    • 支持的值为: TrueFalse

数据

评估 CSV 文件

这是一个 CSV 文件,其中包含对用于评估的测试集的预测。 此文件还包含影响预测的 n-gram(与 BOW.explain_inference 变量值无关)。

此页面是否有帮助?

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