td_retrieve_model
Description
Function to retrieve a saved model accessible to the current user.
Usage
td_retrieve_model(name)
Arguments
name |
Required Argument. |
Value
Object of class "td_analytics" corresponding to the model retrieved.
Examples
# Get remote data source connection.
con <- td_get_context()$connection
# Load example data.
loadExampleData("glm_example", "admissions_train")
# Create object of class "tbl_teradata" to use as input.
admissions_train <- tbl(con, "admissions_train")
# Create the GLM model.
td_glm_out1 <- td_glm_mle(formula = (admitted ~ stats + masters + gpa + programming),
family = "LOGISTIC",
linkfunction = "LOGIT",
data = admissions_train,
weights = "1",
threshold = 0.01,
maxit = 25,
step = FALSE,
intercept = TRUE
)
# Save this generated model.
td_save_model(model = td_glm_out1, name = "glm_model", description = "GLM test")
# Retrieve the saved model.
retrieved_glm_model <- td_retrieve_model("glm_model")
# Use the retrieved model for scoring.
loadExampleData("glmpredict_example", "admissions_test")
admissions_test <- tbl(con, "admissions_test")
td_glm_predict_out1 <- td_glm_predict_sqle(modeldata = retrieved_glm_model,
newdata = admissions_test,
terms = c("id","masters","gpa","stats",
"programming","admitted"),
family = "LOGISTIC",
linkfunction = "LOGIT"
)