UiPath Documentation
ai-center
2021.10
false
Guía del usuario de AI Center
Importante :
La localización de contenidos recién publicados puede tardar entre una y dos semanas en estar disponible.

Clasificación de texto claro

Paquetes listos para usar > Análisis de idioma de UiPath > LightTextClassification

Este es un modelo genérico que se puede volver a entrenar para la clasificación de textos. Admite todos los idiomas basados en caracteres latinos, como inglés, francés, español y otros. Este paquete ML debe entrenarse y, si se implementa sin entrenar primero, fallará con un error que indica que el modelo no está entrenado. Este modelo funciona con Saco de palabras. Este modelo proporciona una explicabilidad basada en n-gramas.

Detalles del modelo

Tipo de entrada

JSON y CSV

Descripción de entrada

Texto que se clasificará como cadena: "Me encantó esta película".

Descripción de salida

JSON con clase y fiabilidad (entre 0 y 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 recomendada

No se requiere GPU.

Capacitación habilitada

De forma predeterminada, el entrenamiento está habilitado.

Procesos

This package supports all three types of pipelines (Full Training, Training, and Evaluation). The model uses advanced techniques to find a performant model using hyperparameter search. By default, hyperparameter search (the BOW.hyperparameter_search.enable variable) is enabled. The parameters of the most performant model are available in the Evaluation Report.

Formato del conjunto de datos

Three options are available to structure your dataset for this model : JSON, CSV and AI Center JSON format. The model will read all CSV and JSON files in the specified directory. For every format, the model expects two columns or two properties, dataset.input_column_name and dataset.target_column_name by default. The names of these two columns and/or directories are configurable using environment variables.

Formato de archivo CSV

Each CSV file can have any number of columns, but only two will be used by the model. Those columns are specified by the dataset.input_column_name and dataset.target_column_name parameters.

Check the following sample and environment variables for a CSV file format example.

text, label
I like this movie, 7
I hated the acting, 9
text, label
I like this movie, 7
I hated the acting, 9

Las variables de entorno para el ejemplo anterior serían las siguientes:

  • dataset.input_format: auto
  • dataset.input_column_name: text
  • dataset.target_column_name: label
Formato de archivo JSON

Varios conjuntos de datos podrían formar parte del mismo archivo JSON.

Check the following sample and environment variables for a JSON file format example.

[
  {
    "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"
  }
]

Las variables de entorno para el ejemplo anterior serían las siguientes:

  • dataset.input_format: auto
  • dataset.input_column_name: text
  • dataset.target_column_name: label
formato de archivo ai_center

Este es el valor predeterminado de las variables de entorno que se pueden establecer, y este modelo leerá todos los archivos en un directorio proporcionado con una extensión .json .

Check the following sample and environment variables for an ai_center file format example.

{
    "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."

Para aprovechar el JSON de muestra anterior, las variables de entorno deben establecerse de la siguiente manera:

  • dataset.input_format: ai_center
  • dataset.input_column_name: data.text
  • dataset.target_column_name: annotations.intent.choices

Entrenamiento en GPU o CPU

No se requiere GPU para el entrenamiento.

Variables de entorno

  • dataset.input_column_name
    • El nombre de la columna de entrada que contiene el texto.
    • El valor predeterminado es data.text.
    • Asegúrese de que esta variable esté configurada de acuerdo con su archivo JSON o CSV de entrada.
  • dataset.target_column_name
    • El nombre de la columna de destino que contiene el texto.
    • El valor predeterminado es annotations.intent.choices.
    • Asegúrese de que esta variable esté configurada de acuerdo con su archivo JSON o CSV de entrada.
  • dataset.input_format
    • El formato de entrada de los datos de entrenamiento.
    • El valor predeterminado es ai_center.
    • Los valores admitidos son: ai_center o auto.
    • If ai_center is selected, only JSON files are supported. Make sure to also change the value of the dataset.target_column_name to annotations.sentiment.choices if ai_center is selected.
    • Si se selecciona auto , se admiten tanto archivos CoNLL como JSON .
  • BOW.hyperparameter_search.enable
    • El valor predeterminado para este parámetro es True. Si se deja habilitado, encontrará el modelo con más rendimiento en el período de tiempo y los recursos de cálculo dados.
    • Esto también generará un archivo PDF HyperparameterSearch_report para mostrar las variaciones de los parámetros que se probaron.
  • BOW.hyperparameter_search.timeout
    • El tiempo máximo que se permite ejecutar la búsqueda de hiperparámetros en segundos.
    • El valor predeterminado es 1800.
  • BOW.explain_inference
    • Cuando se establece en True, durante el tiempo de inferencia cuando el modelo se sirve como habilidad ML, algunos de los n-gramas más importantes también se devolverán junto con la predicción.
    • El valor predeterminado es False.
Variables opcionales

You can add other optional variables by clicking on the Add new button. However, if you set the BOW.hyperparameter_search.enable variable to True, the optimal values of these variables are searched. For the following optional parameters to be used by the model, please set the BOW.hyperparameter_search.enable search variable to False:

  • BOW.lr_kWargs.class_peso
    • Los valores admitidos son: balanced o None.
  • BOW.ngrama_rango
    • Rango de longitud de secuencia de secuencia de palabras consecutivas que pueden considerarse como características para el modelo.
    • Asegúrate de seguir este formato: (1, x), donde x es la longitud máxima de secuencia que quieres permitir.
  • BOW.min_df
    • Se utiliza para establecer el número mínimo de apariciones del n-grama en el conjunto de datos que se considerará como una característica.
    • Los valores recomendados están entre 0 y 10.
  • dataset.text_pp_remove_stop_word
    • Se utiliza para configurar si se deben incluir o no palabras de detención en la búsqueda (por ejemplo, palabras como the, or).
    • Los valores admitidos son: True o False.

Artefactos

El informe de evaluación es un archivo PDF que contiene la siguiente información en un formato legible por humanos:

  • ngramas por clase
  • Diagrama de recuperación de precisión
  • Informe de clasificación
  • Matriz de confusión
  • Mejores parámetros del modelo para la búsqueda de hiperparámetros

ngramas por clase

Esta sección contiene los 10 n-gramas principales que afectan a la predicción del modelo para esa clase. Hay una tabla diferente para cada clase en la que se entrena el modelo.

Diagrama de recuperación de precisión

You can use this diagram and the table to check the precision, recall trade-off, along with f1-scores of the model. The thresholds and corresponding precision and recall values are also provided in a table below this diagram. This table will choose the desired threshold to configure in your workflow so as to decide when to send the data to Action Center for human in the loop. Note that the higher the chosen threshold, the higher the amount of data that gets routed to Action Center for human in the loop will be.

Hay un diagrama de recuperación de precisión para cada clase.

Para ver un ejemplo de un diagrama de recuperación de precisión, consulta la figura siguiente.

Para ver un ejemplo de tabla de recuperación de precisión, consulta la tabla siguiente.

PrecisiónRecordarumbral
0.80122324159021410.67352185089974290.30539842728983285
0.85053380782918150.61439588688946010.37825683923133907
0.90055248618784530.41902313624678660.6121292357073038
0.95145631067961170.25192802056555270.7916427288647211

Informe de clasificación

El informe de clasificación contiene la siguiente información:

  • Etiqueta: la parte de la etiqueta del conjunto de prueba
  • Precisión: la precisión de la predicción.
  • Retirada: instancias relevantes que se recuperaron
  • Puntuación F1: la media geográfica entre precisión y recuperación; puede usar esta puntuación para comparar dos modelos
  • Soporte técnico: el número de veces que aparece una etiqueta determinada en el conjunto de prueba

Para ver un ejemplo de un informe de clasificación, consulta la siguiente tabla.

EtiquetaPrecisiónRecordarEvaluación F1Soporte
0.00.8050.7370.769319
1.00.7310.8120.77389
2.00.7780.7310.754394
3.00.7210.7780.748392
4.00.8550.8440.85385
5.00.9010.8030.849395

Matriz de confusión

Mejores parámetros del modelo para la búsqueda de hiperparámetros

When the BOW.hyperparameter_search.enable variable is set to True the best model parameters picked by the algorithm are displayed in this table. To retrain the model with different parameters not covered by the hyperparameter search you can also set these parameters manually in the Environment variables. For more information on this, check the Environment variables section.

Para ver un ejemplo de este informe, consulta la tabla siguiente.

NombreValor
BOW.ngrama_rango(1, 2)
BOW.min_df2
BOW.lr_kWargs.class_pesoEquilibrado
dataset.text_pp_remove_stop_wordTrue
Informe de búsqueda de hiperparámetros

This report is a PDF file generated only if the BOW.hyperparameter_search.enable parameter is set to True. The report contains the best values for the optional variables and a diagram to display the results.

Archivos JSON

You can find separate JSON files corresponding to each section of the Evaluation Report PDF file. These JSON files are machine-readable and you can use them to pipe the model evaluation into Insights using the workflow.

Datos

Archivo CSV de evaluación

This is a CSV file with predictions on the test set used for evaluation. This file also contains the n-grams that impacted the prediction (irrespective of the BOW.explain_inference variable value).

¿Te ha resultado útil esta página?

Conectar

¿Necesita ayuda? Soporte

¿Quiere aprender? UiPath Academy

¿Tiene alguna pregunta? Foro de UiPath

Manténgase actualizado