Teradata Python Package Function Reference - SVMSparsePredict - Teradata Python Package - Look here for syntax, methods and examples for the functions included in the Teradata Python Package.

Teradata® Python Package Function Reference

Product
Teradata Python Package
Release Number
16.20
Published
February 2020
Language
English (United States)
Last Update
2020-07-17
lifecycle
previous
Product Category
Teradata Vantage

 
teradataml.analytics.sqle.SVMSparsePredict = class SVMSparsePredict(builtins.object)
     Methods defined here:
__init__(self, object=None, newdata=None, sample_id_column=None, attribute_column=None, value_column=None, accumulate_label=None, output_class_num=1, newdata_partition_column=None, newdata_order_column=None, object_order_column=None)
DESCRIPTION:
    The SVMSparsePredict function takes the model generated by the
    SVMSparse trainer function and a set of test samples (in sparse
    format) and outputs a prediction for each sample.
 
 
PARAMETERS:
    object:
        Required Argument.
        Specifies the teradataml DataFrame containing the model
        data generated by SVMSparse or instance of SVMSparse.
 
    object_order_column:
        Optional Argument.
        Specifies Order By columns for object.
        Values to this argument can be provided as a list, if multiple
        columns are used for ordering.
        Types: str OR list of Strings (str)
 
    newdata:
        Required Argument.
        Specifies the teradataml DataFrame containing the input test data.
 
    newdata_partition_column:
        Required Argument.
        Specifies Partition By columns for newdata.
        Values to this argument can be provided as a list, if multiple
        columns are used for partition.
        Types: str OR list of Strings (str)
 
    newdata_order_column:
        Optional Argument.
        Specifies Order By columns for newdata.
        Values to this argument can be provided as a list, if multiple
        columns are used for ordering.
        Types: str OR list of Strings (str)
 
    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: str
 
    attribute_column:
        Required Argument.
        Specifies the name of the newdata column that contains the
        attributes of the test samples.
        Types: str
 
    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: str
 
    accumulate_label:
        Optional Argument.
        Specifies the names of the newdata columns to copy to the
        output teradataml DataFrame.
        Types: str OR list of Strings (str)
 
    output_class_num:
        Optional Argument.
        Valid only for multiple-class models. Specifies the number of class
        labels to appear in the output teradataml DataFrame, with its corresponding
        prediction confidence.
        Default Value: 1
        Types: int
 
RETURNS:
    Instance of SVMSparsePredict.
    Output teradataml DataFrames can be accessed using attribute
    references, such as SVMSparsePredictObj.<attribute_name>.
    Output teradataml DataFrame attribute name is:
        result
 
 
RAISES:
    TeradataMlException
 
 
EXAMPLES:
    # Load the data to run the example.
    load_example_data("SVMSparsePredict",["svm_iris_input_train","svm_iris_input_test"])
 
    # Create teradataml DataFrame
    svm_iris_input_train = DataFrame.from_table("svm_iris_input_train")
    svm_iris_input_test = DataFrame.from_table("svm_iris_input_test")
 
    # Create SparseSVMTrainer object
    svm_train = SVMSparse(data=svm_iris_input_train,
                        sample_id_column='id',
                        attribute_column='attribute',
                        label_column='species',
                        value_column='value1',
                        max_step=150,
                        seed=0,
                        )
 
    # Example 1
    # Instance of SVMTrainer is passed as input to object argument
    svm_sparse_predict_result1 = SVMSparsePredict(newdata=svm_iris_input_test,
                                                 newdata_partition_column=['id'],
                                                 object=svm_train,
                                                 attribute_column='attribute',
                                                 sample_id_column='id',
                                                 value_column='value1',
                                                 accumulate_label='species'
                                                 )
 
    # Print the result DataFrame
    print(svm_sparse_predict_result1.result)
 
    # Example 2
    # teradataml DataFrame containing the model data generated by SVMSparse is passed as input to object argument
    svm_sparse_predict_result2 = SVMSparsePredict(newdata=svm_iris_input_test,
                                                 newdata_partition_column=['id'],
                                                 object=svm_train.model_table,
                                                 attribute_column='attribute',
                                                 sample_id_column='id',
                                                 value_column='value1',
                                                 accumulate_label='species'
                                                 )
    # Print the result DataFrame
    print(svm_sparse_predict_result2.result)
__repr__(self)
Returns the string representation for a SVMSparsePredict class instance.