Description
The SparseSVMPredictor (td_svm_sparse_predict_sqle
) function takes the model generated
by the function SparseSVMTrainer (td_svm_sparse_mle
) and a set of test samples (in sparse
format) and outputs a prediction for each sample.
Usage
td_svm_sparse_predict_sqle ( object = NULL, newdata = NULL, sample.id.column = NULL, attribute.column = NULL, value.column = NULL, accumulate.label = NULL, output.class.num = 1, newdata.partition.column = NULL) ## S3 method for class 'td_svm_sparse_mle' predict( object = NULL, newdata = NULL, sample.id.column = NULL, attribute.column = NULL, value.column = NULL, accumulate.label = NULL, output.class.num = 1, newdata.partition.column = NULL)
Arguments
object |
Required Argument. |
newdata |
Required Argument. |
newdata.partition.column |
Partition By columns for newdata. |
sample.id.column |
Required Argument. |
attribute.column |
Required Argument. |
value.column |
Optional Argument. |
accumulate.label |
Optional Argument. |
output.class.num |
Optional Argument. |
Value
Function returns an object of class "td_svm_sparse_predict_sqle" 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("svmsparsepredict_example", "svm_iris_input_test", "svm_iris_input_train") # Create remote tibble objects. svm_iris_input_train <- tbl(con, "svm_iris_input_train") svm_iris_input_test <- tbl(con, "svm_iris_input_test") # Example - # Create the Sparse SVM model. svm_train <- td_svm_sparse_mle(data = svm_iris_input_train, sample.id.column = 'id', attribute.column = 'attribute', value.column = 'value1', label.column = 'species', max.step = 150, seed = 0 ) # Run predict on the output of td_svm_sparse_mle. svm_sparse_predict_result <- td_svm_sparse_predict_sqle(newdata = svm_iris_input_test, newdata.partition.column = c("id"), object = svm_train, sample.id.column = "id", attribute.column = "attribute", value.column = "value1", accumulate.label = c("species") ) # Alternatively use S3 predict on the output of td_svm_sparse_mle to find prediction. predict_out <- predict(svm_train, newdata = svm_iris_input_test, newdata.partition.column = c("id"), sample.id.column = "id", attribute.column = "attribute", value.column = "value1", accumulate.label = c("species") )