predictLabelFromText

Predict a label from text (prediction).

Predict a label for each event in the table using the model that was created by the createModelFromText operator, which learns how to predict labels from a text.

For example, consider a table with two columns: list of all cities in a country (comma-separated string) be first column and country name. The task is to train a model that can identify country name from a list of cities. The list of cities in the prediction can be incomplete compared to the training list. For instance, adding "Cleveland, London, Paris, Venice" would predict "USA" because cities with all four of the names are found in the USA in addition to other countries.

Cleveland, London => USA, England
Paris => France, USA(CA)
Venice => Italy, USA(FL)

Operator Usage in Easy Mode

  1. Click + on the parent node.
  2. Enter the Predict Label from Text operator in the search field and select the operator from the Results to open the operator form.
  3. In the Table drop-down, enter or select the name of the table to apply the prediction.
  4. In the Model Name drop-down, enter or select the name of the model.
  5. Optional. In the Column Names, click Add More to add the list of column names used to predict the label.
  6. Click Run to view the result.
  7. Click Save to add the operator to the playbook.
  8. Click Cancel to discard the operator form.

Usage Details

predictLabelFromText(table, outputModelName, listOfColumns)

Input

table: Input table to train a model.
outputModelName: Model name that was created using the createModelFromText operator. Trained models are not displayed in the UI, so remember the name of the model that was created. If a model with the same name exists, this operation overwrites it without notification.
listOfColumns: List of columns to use for prediction. The order must be the same as listOfColumns during the training step.

Output

Input table plus an additional column: lhub_predicted_label.

Example

Input
table = github_logs

id title description
1a, bh, i
1a, xu, v

LQL: "lettersToUser" is model name that was created from the example section of create model from text .

predictLabelFromText(table,"scoreEmail", "title", "description")

Output

id title description lhub_predicted_label
1a, bh, ispam
1a, xu, vham

Did this page help you?