SparseSVMPredictor
Description
The SparseSVMPredictor 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_mle_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,
newdata.order.column = NULL,
object.order.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,
newdata.order.column = NULL,
object.order.column = NULL)
Arguments
object |
Required Argument. |
object.order.column |
Optional Argument. |
newdata |
Required Argument. |
newdata.partition.column |
Required Argument. |
newdata.order.column |
Optional Argument. |
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_mle_sqle"
which is a named list containing object of class "tbl_teradata".
Named list member can be referenced directly with the "$" operator
using the 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 object(s) of class "tbl_teradata".
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() function.
svm_sparse_predict_result <- td_svm_sparse_predict_mle_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")
)