Language Model Action Set

Calculating Error Rates by Using Default Options

This example is not available for the CAS programming language.

Calculating Error Rates by Using Default Options

This example is not available for the Lua programming language.

Calculating Error Rates by Using Default Options

This section contains Python code. For more information about coding in Python, see Getting Started with SAS Viya for Python and SAS Viya: System Programming Guide.

The following code shows how you can use the calculateErrorRate action to calculate error rates:

                            reference = {"name": "reference_table_name"},
                            )

You need to modify the values of the table and reference parameters to name the input hypothesis table and the input reference table you want to use.

Each row in the table that you specify in the table parameter represents the hypothesis information of a sample. By default, the calculateErrorRate assumes that the formatted value in the first column is the ID of the sample and that the second column contains the corresponding hypothesis text. Similarly, each row in the table that you specify in the reference parameter represents the reference information of a sample. By default, the action assumes that the formatted value in the first column is the ID of the sample, and that the second column contains the corresponding reference text.

An example of an input hypothesis table that you specify in the table parameter is illustrated in Figure 1. An example of an input reference table that you specify in the reference parameter is illustrated in Figure 2. In addition, Figure 3 shows the sample of output tables.

Figure 1: Sample Input Hypothesis Table

Sample Input Hypothesis Table


Figure 2: Sample Input Reference Table

Sample Input Reference Table


Notice that only rows 0, 1, 3, and 4 in the hypothesis table have IDs that match IDs in rows in the reference table (in rows 0, 1, 2, and 3). Therefore, the action evaluates only those four rows, as shown in Figure 3.

Figure 3: Sample Output Tables

Sample Output Tables


Calculating Error Rates by Using Default Options

This example is not available for the R programming language.

Last updated: November 04, 2020