Description
The GLML1L2Predict function uses the model output by the GLML1L2 (td_glml1l2_mle
)
function to perform generalized linear model prediction on new input
data.
Usage
td_glml1l2_predict_mle ( modeldata = NULL, newdata = NULL, accumulate = NULL, output.prob = FALSE, output.responses = NULL, newdata.sequence.column = NULL, modeldata.sequence.column = NULL, newdata.order.column = NULL, modeldata.order.column = NULL ) ## S3 method for class 'td_glml1l2_mle' predict( modeldata = NULL, newdata = NULL, accumulate = NULL, output.prob = FALSE, output.responses = NULL, newdata.sequence.column = NULL, modeldata.sequence.column = NULL, newdata.order.column = NULL, modeldata.order.column = NULL)
Arguments
modeldata |
Required Argument. |
modeldata.order.column |
Optional Argument. |
newdata |
Required Argument. |
newdata.order.column |
Optional Argument. |
accumulate |
Optional Argument. |
output.prob |
Optional Argument. |
output.responses |
Optional Argument. |
newdata.sequence.column |
Optional Argument. |
modeldata.sequence.column |
Optional Argument. |
Value
Function returns an object of class "td_glml1l2_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("glml1l2_example", "admissions_train", "housing_train") loadExampleData("glml1l2predict_example", "admissions_test", "housing_test") # Create remote tibble objects. admissions_train <- tbl(con, "admissions_train") admissions_test <- tbl(con, "admissions_test") housing_train <- tbl(con, "housing_train") housing_test <- tbl(con, "housing_test") # Example 1 - # Generate a model based on train data "admissions_train". td_glml1l2_mle_out1 <- td_glml1l2_mle(formula = (admitted ~ stats + gpa + masters + programming), data = admissions_train, alpha = 0, lambda = 0.02, family = "Binomial", randomization = TRUE ) # Use the generated model to predict the 'admissions' on the test data # admissions_test by using model generated by GLML1L2, and also output the probabilities. td_glml1l2_predict_mle_out1 <- td_glml1l2_predict_mle(newdata = admissions_test, modeldata = td_glml1l2_mle_out1, accumulate = c("id"), output.prob = TRUE ) # Example 2 - # Generate a model based on train data "housing_train". td_glml1l2_mle_out2 <- td_glml1l2_mle(formula = (price ~ lotsize + bedrooms + gashw + driveway + stories + recroom + garagepl + bathrms + homestyle + fullbase + airco + prefarea), data = housing_train, alpha = 1, lambda = 0.02, family = "Gaussian", randomization = TRUE ) # Use the generated model to predict the 'price' on the test data # housing_test by using the 'output' tbl_teradata from the model # generated by GLML1L2 as modeldata. td_glml1l2_predict_mle_out2 <- td_glml1l2_predict_mle(newdata = housing_test, modeldata = td_glml1l2_mle_out2$output, accumulate = c("sn") ) # Alternatively use the generic S3 predict function to make prediction. td_glml1l2_predict_mle_out21 <- predict(td_glml1l2_mle_out2, newdata = housing_test, accumulate = c("sn") )