RegressionEvaluator
Description
The td_regression_evaluator_sqle()
function computes metrics to evaluate and compare
multiple models and summarizes how close predictions are to their expected
values.
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_regression_evaluator_sqle (
data = NULL,
observation.column = NULL,
prediction.column = NULL,
metrics = NULL,
independent.features.num = NULL,
freedom.degrees = NULL
)
Arguments
data |
Required Argument. |
observation.column |
Required Argument. |
prediction.column |
Required Argument. |
metrics |
Optional Argument.
Types: character OR vector of Strings (character) |
independent.features.num |
Optional Argument. |
freedom.degrees |
Optional Argument. **generic_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_regression_evaluator_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
Examples
# Get the current context/connection.
con <- td_get_context()$connection
# Set the option 'val.install.location'.
options(val.install.location = "val")
# Create required tbl_teradata.
# Load the example data.
loadExampleData("tdplyr_example", "titanic")
# Create tbl_teradata object.
titanic <- tbl(con, "titanic")
# First generate linear regression model using LinReg() function from 'valib'.
lin_reg_obj <- td_lin_reg_valib(data=titanic,
columns=c("age", "survived", "pclass"),
response.column="fare")
# Score the data using the linear regression model generated above.
obj <- td_lin_reg_predict_valib(data=titanic,
model=lin_reg_obj$model,
accumulate = "fare",
response.column="fare_prediction")
# Check the list of available analytic functions.
display_analytic_functions()
# Example 1 : Compute 'RMSE', 'R2' and 'FSTAT' metrics to evaluate
# the model.
RegressionEvaluator_out <- td_regression_evaluator_sqle(
data = obj$result,
observation.column = "fare",
prediction.column = "fare_prediction",
freedom.degrees = c(1, 2),
independent.features.num = 2,
metrics = c('RMSE','R2','FSTAT'))
# Print the result.
print(RegressionEvaluator_out$result)