- 发行说明
- 在开始之前
- 入门指南
- 安装 AI Center
- 迁移和升级
- 项目
- 数据集
- 数据标签
- ML 包
- 开箱即用包
- 管道
- ML 技能
- ML 日志
- AI Center 中的 Document Understanding™
- AI Center API
- 如何
- 许可
- 基本故障排除指南

AI Center 用户指南
“开箱即用包”>“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_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, 9text, label
I like this movie, 7
I hated the acting, 9上一个示例的环境变量如下:
- dataset.input_format: auto
- dataset.input_column_name: text
- dataset.target_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.target_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": "[email protected]",
        "date": "1/29/2020 12:39:01 PM",
        "from": "[email protected]",
        "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": "[email protected]",
        "date": "1/29/2020 12:39:01 PM",
        "from": "[email protected]",
        "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_name:annotations.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_center或auto。
- 如果选择ai_center,则仅支持JSON文件。 如果选择了ai_center,请确保还将 dataset.target_column_name 的值更改为annotations.sentiment.choices。
- 如果选择auto,则同时支持CoNLL和JSON文件。
 
- BOW.hyperparameter_search.enable- 此参数的默认值为True。 如果保持启用状态,这将在给定的时间范围内找到性能最高的模型和计算资源。
- 这还将生成HyperparameterSearch_reportPDF 文件,以展示已尝试的参数变体。
 
- 此参数的默认值为
- BOW.hyperparameter_search.timeout- 允许运行超参数搜索的最长时间 (以秒为单位)。
- 默认值为 1800。
 
- BOW.explain_inference- 如果将其设置为True,则在将模型用作 ML 技能的推理期间,一些最重要的 n-gram 也将与预测一起返回。
- 默认值为 False。
 
- 如果将其设置为
可选变量
True ,则会搜索这些变量的最佳值。对于模型要使用的以下可选参数,请将BOW.hyperparameter_search.enable搜索变量设置为False :
                     - BOW.lr_kwargs.class_weight- 支持的值为: balanced或None。
 
- 支持的值为: 
- BOW.ngram_range- 可被视为模型特征的连续单词序列的序列长度范围。
- 请务必遵循以下格式: (1, x),其中x是您要允许的最大序列长度。
 
- BOW.min_df- 用于设置要视为特征的数据集中 n-gram 的最小出现次数。
- 建议的值介于0和10之间。
 
- dataset.text_pp_remove_stop_words- 用于配置是否应在搜索中包含停用词(例如, the、or等词)。
- 支持的值为: True或False。
 
- 用于配置是否应在搜索中包含停用词(例如, 
数据
评估 CSV 文件
这是一个 CSV 文件,其中包含对用于评估的测试集的预测。 此文件还包含影响预测的 n-gram(与 BOW.explain_inference 变量值无关)。