Description
The LARPredict function (td_lar_predict_mle
) takes new data and the model generated by
the function LAR (td_lar_mle
) and uses the predictors in the model to output
predictions for the new data.
Usage
td_lar_predict_mle ( object = NULL, newdata = NULL, mode = "STEP", s = NULL, target.col = NULL, object.sequence.column = NULL, newdata.sequence.column = NULL ) ## S3 method for class 'td_lar_mle' predict( object = NULL, newdata = NULL, mode = "STEP", s = NULL, target.col = NULL, object.sequence.column = NULL, newdata.sequence.column = NULL )
Arguments
object |
Required Argument. |
newdata |
Required Argument. |
mode |
Optional Argument.
Default Value: STEP. |
s |
Optional Argument. |
target.col |
Optional Argument. |
object.sequence.column |
Optional Argument. |
newdata.sequence.column |
Optional Argument. |
Value
Function returns an object of class "td_lar_predict_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("larpredict_example", "diabetes_test", "diabetes") # Create remote tibble objects. diabetes_test <- tbl(con, "diabetes_test") diabetes <- tbl(con, "diabetes") %>% rename_all(tolower) # Build a LAR model with response variable 'y' and ten baseline predictors. td_lar_out <- td_lar_mle(formula = (y ~ hdl + glu + ldl + map1 + sex + tch + age + ltg + bmi + tc), data = diabetes, type = "LAR", max.steps = 20, intercept = TRUE ) # Example: Use the model object directly as input to the td_lar_predict_mle function. td_lar_predict_out1 <- td_lar_predict_mle(object = td_lar_out, newdata = diabetes_test, mode = "step", s = 1.6, target.col = c("y") ) # Example: Alternatively use the predict S3 method to find predictions. predict_out <- predict(td_lar_out, newdata = diabetes_test, mode = "step", s = 1.6, target.col = c("y") ) # Example: Use the table from a previously created model # Extract the model table using the 'extract2' function td_lar_out_tbl <- td_lar_out %>% extract2(1) td_lar_predict_out2 <- td_lar_predict_mle(object = td_lar_out_tbl, newdata = diabetes_test, mode = "step", s = 1.6, target.col = c("y") ) # The prediction result can be persisted in a table - "result_td_lar_predict_out2". copy_to(con, df = td_lar_predict_out2$result, name = "result_td_lar_predict_out2", overwrite = TRUE)