Teradata Package for R Function Reference | 17.20 - SVMSparsePredict - 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

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Teradata Package for R
Release Number
17.20
Published
March 2024
Language
English (United States)
Last Update
2024-05-03
dita:id
TeradataR_FxRef_Enterprise_1720
Product Category
Teradata Vantage

SVMSparsePredict

Description

The td_svm_sparse_predict_mle_sqle() function takes the model generated by the td_svm_sparse_mle() trainer function and a set of test samples (in sparse format) and outputs a prediction for each sample.

Usage

  td_svm_sparse_predict_mle_sqle (
      object = NULL,
      newdata = NULL,
      sample.id.column = NULL,
      attribute.column = NULL,
      value.column = NULL,
      accumulate.label = NULL,
      output.class.num = 1,
      output.prob = TRUE,
      output.responses = NULL,
      ...
  )

Arguments

object

Required Argument.
Specifies the tbl_teradata containing the model data generated by td_svm_sparse_mle() function or instance of td_svm_sparse_mle.
Types: tbl_teradata or td_svm_sparse_mle

newdata

Required Argument.
Specifies the tbl_teradata containing the input test data.
Types: tbl_teradata

sample.id.column

Required Argument.
Specifies the name of the newdata column that contains the identifiers of the test samples. The newdata table must be partitioned by this column.
Types: character

attribute.column

Required Argument.
Specifies the name of the newdata column that contains the attributes of the test samples.
Types: character

value.column

Optional Argument.
Specifies the name of the newdata column that contains the attribute values. By default, each attribute has the value 1.
Types: character

accumulate.label

Optional Argument.
Specifies the names of the newdata columns to copy to the output tbl_teradata.
Types: character OR vector of Strings (character)

output.class.num

Optional Argument.
Specifies the number of class labels to appear in the output tbl_teradata, with its corresponding prediction confidence.
Valid only for multiple-class models.
Default Value: 1
Types: integer

output.prob

Optional Argument.
Specifies whether to display output probability for the predicted category.
Default Value: TRUE
Types: logical

output.responses

Optional Argument.
Specifies responses for which to output probabilities.
Types: character OR vector of Strings (character)

...

Specifies the generic keyword arguments SQLE functions accept.
Below are the generic keyword arguments:

persist:
Optional Argument.
Specifies whether to persist the results of the function in a table or not.
When set to TRUE, results are persisted in a table; otherwise, results are garbage collected at the end of the session.
Default Value: FALSE
Types: logical

volatile:
Optional Argument.
Specifies whether to put the results of the function in a volatile table or not.
When set to TRUE, results are stored in a volatile table, otherwise not.
Default Value: FALSE
Types: logical

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:

  • "<input.data.arg.name>.partition.column" accepts character OR vector of Strings (character) (Strings)

  • "<input.data.arg.name>.hash.column" accepts character OR vector of Strings (character) (Strings)

  • "<input.data.arg.name>.order.column" accepts character OR vector of Strings (character) (Strings)

  • "local.order.<input.data.arg.name>" accepts logical

Note:
These generic arguments are supported by tdplyr if the underlying SQL Engine function supports, else an exception is raised.

Value

Function returns an object of class "td_svm_sparse_predict_mle_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
    
    # Load the data to run the example.
    loadExampleData("svmsparsepredict_example", "svm_iris_input_test", "svm_iris_model")
    
    # Create tbl_teradata
    svm_train <- tbl(con, "svm_iris_model")
    svm_iris_input_test <- tbl(con, "svm_iris_input_test")
    
    # Check the list of available analytic functions.
    display_analytic_functions()
    
    # Example 1: tbl_teradata containing the model data is passed as input
    #            to object argument.
    svm_sparse_predict_result1 <- td_svm_sparse_predict_mle_sqle(
                                    newdata=svm_iris_input_test,
                                    object=svm_train,
                                    attribute.column='attribute',
                                    sample.id.column='id',
                                    value.column='value1',
                                    accumulate.label='species')
    
    # Print the result.
    print(svm_sparse_predict_result1$result)
    
    # Example 2: Predict the species and display probability for "setosa" and "virginica".
    svm_sparse_predict_result2 <- td_svm_sparse_predict_mle_sqle(
                                    newdata=svm_iris_input_test,
                                    object=svm_train,
                                    attribute.column='attribute',
                                    sample.id.column='id',
                                    value.column='value1',
                                    accumulate.label='species',
                                    output.prob= TRUE,
                                    output.responses= c('setosa', 'virginica'))
    
    # Print the result.
    print(svm_sparse_predict_result2$result)