ROC
Description
The td_roc_sqle
accepts
a set of prediction-actual pairs for a binary classification
model and calculates the following values for a range
of discrimination thresholds:
TRUE positive rate (TPR)
FALSE positive rate (FPR)
The area under the ROC curve (AUC)
Gini coefficient
A ROC curve shows the
performance of a binary classification model as its discrimination
threshold varies. For a range of thresholds, the curve plots the
true positive rate against the false-positive rate.
Notes:
This function requires the UTF8 client character set for UNICODE data.
This function does not support Pass Through Characters (PTCs). For information about PTCs, see Teradata Vantage™ - Analytics Database International Character Set Support.
This function does not support KanjiSJIS or Graphic data types.
Usage
td_roc_sqle (
data = NULL,
probability.column = NULL,
observation.column = NULL,
model.id.column = NULL,
positive.label = NULL,
num.thresholds = 50,
auc = TRUE,
gini = TRUE,
...
)
Arguments
data |
Required Argument. |
probability.column |
Required Argument. |
observation.column |
Required Argument. |
model.id.column |
Optional Argument. positive_class: |
positive.label |
|
num.thresholds |
Optional Argument. |
auc |
Optional Argument. |
gini |
Optional Argument. |
... |
Specifies the generic keyword arguments SQLE functions accept. Below
are the generic keyword arguments: volatile: Function allows the user to partition, hash, order or local order the input data. These generic arguments are available for each argument that accepts tbl_teradata as input and can be accessed as:
Note: |
Value
Function returns an object of class "td_roc_sqle"
which is a named list containing object of class "tbl_teradata".
Named list member(s) can be referenced directly with the "$" operator
using the name(s):
result
output.data
Examples
# Get the current context/connection.
con <- td_get_context()$connection
# Load the example data.
loadExampleData("tdplyr_example", "roc_input")
# Create tbl_teradata object.
roc_input <- tbl(con, "roc_input")
# Check the list of available analytic functions.
display_analytic_functions()
# Example 1 : Calculating True-Positive Rate (TPR), False-Positive Rate (FPR),
# Area Under the td_roc_sqle Curve (AUC), Gini Coefficient for a range
# of discrimination thresholds.
roc_out <- td_roc_sqle(
probability.column="probability",
observation.column="observation",
model.id.column="model_id",
positive.class="1",
data=roc_input)
# Print the result.
print(roc_out$result)
print(roc_out$output.data)