Teradata R Package Function Reference - 16.20 - NamedEntityFinderEvaluator - Teradata R Package

Teradata® R Package Function Reference

prodname
Teradata R Package
vrm_release
16.20
created_date
February 2020
category
Programming Reference
featnum
B700-4007-098K

Description

The td_namedentity_finder_evaluator_mle function invokes the NamedEntityFinderEvaluatorMap and NamedEntityFinderEvaluatorReduce functions, which operate as a row and a partition function, respectively. Each function takes a set of evaluating data and generates the precision, recall, and F-measure values of a specified maximum entropy data model. The function does not support regular-expression-based or dictionary-based models.

Usage

  td_namedentity_finder_evaluator_mle (
      newdata = NULL,
      text.column = NULL,
      model = NULL,
      newdata.sequence.column = NULL
  )

Arguments

newdata

Required Argument.
Specifies the input tbl_teradata containing the text column to analyze.

text.column

Required Argument.
Specifies the name of the input tbl_teradata column that contains the text to analyze.

model

Required Argument.
Specifies name of the model file to evaluate. The function td_namedentity_finder_trainer_mle can be used to create a model file.

newdata.sequence.column

Optional Argument.
Specifies the vector of column(s) that uniquely identifies each row of the input argument "newdata". The argument is used to ensure deterministic results for functions which produce results that vary from run to run.

Value

Function returns an object of class "td_namedentity_finder_evaluator_mle" which is a named list containing Teradata tbl object.
Named list member can be referenced directly with the "$" operator using name: result.

Examples

    # Get the current context/connection
    con <- td_get_context()$connection
    
    # Load example data.
    loadExampleData("namedentityfinderevaluator_example", "nermem_sports_test")
    loadExampleData("namedentityfindertrainer_example", "nermem_sports_train")
    
    # Create remote tibble objects.
    nermem_sports_train <- tbl(con, "nermem_sports_train")
    nermem_sports_test <- tbl(con, "nermem_sports_test")

    # Train a namedentity finder model on entity type: "LOCATION".
    # The trained model is stored in a binary file: "location.sports".
    td_nef_trainer_out <- td_namedentity_finder_trainer_mle(data = nermem_sports_train,
                                                            text.column = "content",
                                                            entity.type = "LOCATION",
                                                            model.file = "location.sports"
                                                            )

    # Example: Use the model file: location.sports as the input model on the test 
    # data: nermem_sports_test.
    td_nef_evaluator_out <- td_namedentity_finder_evaluator_mle(newdata = nermem_sports_test,
                                                                text.column = "content",
                                                                model = "location.sports"
                                                                )