Teradata Package for R Function Reference | 17.00 - td_save_model - Teradata Package for R - Look here for syntax, methods and examples for the functions included in the Teradata Package for R.

Teradata® Package for R Function Reference

Product
Teradata Package for R
Release Number
17.00
Published
July 2021
Language
English (United States)
Last Update
2023-08-08
dita:id
B700-4007
NMT
no
Product Category
Teradata Vantage
td_save_model

Description

Function to save a tdplyr analytic function model to the Model Catalog.

Usage

td_save_model(
  model,
  name,
  description,
  model.project = NULL,
  entity.target = NULL,
  performance.metrics = NULL
)

Arguments

model

Required Argument.
Specifies the tdplyr analytic function model to be saved.
Types: Object of class td_analytics

name

Required Argument.
Specifies the unique name to identify the model to be saved.
The maximum length of the "name" is 128 characters.
Types: character

description

Required Argument.
Specifies a note describing the model to be saved.
The maximum length of the "description" is 1024 characters.
Types: character

model.project

Optional Argument.
Specifies a project name that the model is associated with.
The maximum length of the "model.project" is 128 characters.
Types: character

entity.target

Optional Argument.
Specifies a group or team that the model is associated with.
The maximum length of the "entity.target" is 128 characters.
Types: character

performance.metrics

Optional Argument.
Specifies the performance metrics for the model.
"performance.metrics" must be a named list of the following form:
list(<metric> = list(measure = <value>), ...)
For example:
list(AUC = list(measure = 0.5), ...)
The value should be of type numeric.
Types: Named list of numeric values

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")