Сравнение версий

Ключ

  • Эта строка добавлена.
  • Эта строка удалена.
  • Изменено форматирование.

...

Classify text Version 1 (python)

Группа Group "Robin AI", подгруппа "Машинное обучениеsubgroup "Classifier (Robin)"

Описание

Действие определяет класс, к которому относится текст, на основе обученной модели классификации, т.е. показывает вероятность отношения текста к определенному классу, соответствующему рубрике на основе обученного метода классификации.

Целью выполнения действия является определение той рубрики, к которой ближе всего относится текст, то есть должна быть определена рубрика с наибольшим процентом точности, чтобы позволить принять решение о дальнейших действиях с этим текстом. 

Image Removed

Параметры

Входные параметры

...

Description

The action determines the class to which the text belongs based on the trained classification model, i.e. it shows the probability that the text belongs to a certain class corresponding to a rubric based on the trained classification method.

The purpose of the action is to determine the rubric to which the text is closest, i.e. the rubric with the highest percentage of accuracy must be determined to allow a decision to be made about further actions with this text. 

Image Added

Parameters

Input parameters

  1. Text for classification - text whose class is to be defined. The language can be any language. If there is a language different from the language of the training sample, the percentage of class definition will be close to zero.
  2. Trained model - the path to the folder that contains the trained classification model. The folder must contain two files
  3. Текст для классификации - текст, класс которого необходимо определить. Язык может быть любой. Если будет язык отличный от языка обучающей выборки, то процент определения класса будет близким к нулю.
  4. Обученная модель - путь к папке, которая содержит обученную модель классификации. В папке должно содержаться два файла: machine_model.pkl и tfidf_model.pk.   Отсутствие какого-то файла или изменение имени папки на другое может привести к ошибке.

Выходные параметры

  1. Результат  - словарь, где ключ - название класса, а значение - процент вхождения в данный класс. Сортировка в словаре производится по проценту вхождения в класс.

Настройки

  1. Missing some file or changing the folder name to another one may cause an error.

Output parameters

  1. Result is a dictionary, where the key is the class name and the value is the percentage of occurrence in the given class. Sorting in the dictionary is performed by the percentage of occurrences in the class.

Settings

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
Text for classificationThe text whose class needs to be defined.Robin.String
Yes
Trained modelThe path to the folder that contains the trained classification model

Свойство

Описание

Тип

Пример заполнения

Обязательность заполнения поля

Параметры

Текст для классификации

Текст для классификации

Robin.String

Да

Обученная модель

Путь к папке, которая содержит обученную модель
.Robin.FolderPathC:\doc\img
Да
Yes
Результаты
Results
Результат
Result
Словарь, где Ключ - рубрика, а Значение - процент вхождения в данную рубрику. Сортировка в словаре по проценту вхождения в рубрику
Dictionary, where the key is the name of the class, and the value is the percentage of entry into this class. Sorting in the dictionary by the percentage of entry into the class.Robin.Dictionary

Особые условия использования 



Special conditions of use 

1. The folder that contains the trained model must contain two files.  The files are provided to the customer upon request.  These files represent the packaged machine learning model1.В папке, которая содержит обученную модель, должно содержаться два файла.  Файлы предоставляются заказчику по требованию.  Данные файлы представляют из себя запакованную модель машинного обучения


2. Если какого-то файла нет/другое название, то это приведет к ошибке при работе действияIf some file is missing/another name, it will cause an error when the action runs

3. Робот выдаст ошибку, если:

  • в поле "Обученная модель" указан неверный путь/не содержит обученную модель (один или два файла изменены);
  • в поле "Текст для классификации" указана пустая строка или действие не смогло определить класс.

4.Робот не выдаст ошибку, если:

  • подан текст не на языке обученной модели, при этом % совпадения с классом будет небольшой. 

5. Существующую обученную модель нельзя "дообучать", при необходимости добавления классов,  необходимо заново запустить действие по обучению модели  

6. Для сведения обученная модель на 20000 записей классифицирует текст за 2-3 минуты.

The robot will generate an error if:

  • incorrect path is specified in the "Trained model" field/ does not contain a trained model (one or two files have been changed);
  • an empty string is specified in the "Text for classification" field or the action was unable to determine the class.

4. The robot will not generate an error if:

  • the text is not in the language of the trained model, and the % of match with the class will be small. 

5. An existing trained model cannot be "re-trained", if classes need to be added, the model training action must be re-launched.

6. For reference, a trained model on 20000 records classifies text in 2-3 minutes.

More information about text classification theoryДополнительная информация о теории классификации текста

https://vas3k.blog/blog/machine_learning/

https://www.edureka.co/blog/classification-in-machine-learning/

Пример использования

Задача

Example of use

Task

Classify text based on a trained modelКлассифицировать текст на основе обученной модели

...

Solution

Воспользоваться действием "Классифицировать текст"Use the "Classify text" action

...

Implementation

  1. Перенести действие "Классифицировать текст" на рабочую областьTransfer the "Classify text" action to the workspace

  2. Заполнить параметры действия "Классифицировать текст"Set the parameters of the "Classify text" action
    В поле "Текст для классификации" указать следующий текстSpecify the following text in the "Text to classify" field

          

        3. Указать путь к папке, которая содержит обученную модель Specify the path to the folder that contains the trained model



4. Нажать на кнопку "Старт" в верхней панели.  

Результат 

Программный робот отработал успешно. Получен словарь , где Ключ - рубрика, а Значение - процент вхождения в данную рубрику. Сортировка в словаре по проценту вхождения в рубрику.

Image Removed

В результате получился словарь с названием категории и с точностью принадлежности к данной категории.  

Click on the "Start" button in the top panel.  

Result

The program robot completed successfully. The dictionary is obtained , where Key is a heading and Value is the percentage of occurrences in this heading. Sorting in the dictionary by the percentage of occurrence in the rubric.

Image Added

The result is a dictionary with the name of the category and the accuracy of belonging to this category.  

If it is necessary to get the rubric to which the text belongs to the most extent, it is necessary to use the "Get key collection" action, because the % values are specified in the values, and the rubrics-categories themselves are in the keys. Next, we need to get a collection of keys and the zero element of this collection is the heading to which the text most likely belongs (action "Get value by indexПри необходимости получения рубрики к которой текст относится в наибольшей степени необходимо воспользоваться действием "Получить коллекцию ключей", потому что в значениях % указаны, а сами рубрики-категории в ключах. Далее, нужно получить коллекцию ключей и нулевой элемент этой коллекции - это та рубрика, к которой скорее всего относится текст (действие "Получить значение по индексу").