| |
Methods defined here:
- __init__(self, object=None, newdata=None, sample_id_column=None, attribute_column=None, value_column=None, accumulate_label=None, output_response_probdist=True, output_responses=None, output_class_num=None, newdata_sequence_column=None, object_sequence_column=None, newdata_partition_column=None, newdata_order_column=None, object_order_column=None)
- DESCRIPTION:
The SVMSparsePredictor function takes the model generated by the
SVMSparse, a trainer function and a set of test samples (in sparse
format) and outputs a prediction for each sample.
Note: This function is available only when teradataml is connected to
Vantage 1.1 or later versions.
PARAMETERS:
object:
Required Argument.
Specifies the teradataml DataFrame containing the model data
generated by SVMSparse or instance of SVMSparse, which contains
the model.
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 column in newdata, teradataml DataFrame
that contains the identifiers of the test samples. The data
must be partitioned by this column.
Types: str
attribute_column:
Required Argument.
Specifies the name of the column in newdata, teradataml DataFrame
that contains the attributes of the test samples.
Types: str
value_column:
Optional Argument.
Specifies the name of the column in newdata, teradataml DataFrame
that contains the attribute values. By default, each attribute
has the value 1.
Types: str
accumulate_label:
Optional Argument.
Specifies the name of the column in newdata, teradataml DataFrame
to copy to the output table.
Types: str OR list of Strings (str)
output_response_probdist:
Optional Argument.
Specifies whether to display output probability for the predicted
category.
Note: "output_response_probdist" argument support is only available when
teradataml is connected to Vantage 1.1.1 or later versions.
Default Value: True
Types: bool
output_responses:
Optional Argument.
Specifies responses in the input table.
This argument can only be used when output_response_probdist is True.
Note:
1. "output_responses" argument support is only available when teradataml is
connected to Vantage 1.1.1 or later versions.
2. "output_responses" can not be specified along with "output_class_num".
3. This argument requires the "output_response_probdist" argument to be set to True.
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 table, with its corresponding
prediction confidence.
Note:
1. With Vantage version prior to 1.1.1, the argument defaults to
the value 1.
2. "output_class_num" cannot be specified along with "output_responses".
Types: int
newdata_sequence_column:
Optional Argument.
Specifies the list of column(s) that uniquely identifies each row of
the input argument "newdata". The argument is used to ensure
deterministic results for functions which produce results that vary
from run to run.
Types: str OR list of Strings (str)
object_sequence_column:
Optional Argument.
Specifies the list of column(s) that uniquely identifies each row of
the input argument "object". The argument is used to ensure
deterministic results for functions which produce results that vary
from run to run.
Types: str OR list of Strings (str)
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.
# SVMSparse takes training data, svm_iris_input_train, which contains four iris attributes
# (sepal length, sepal width, petal length, and petal width), grouped into three categories
# (setosa, versicolor, and virginica) and outputs a predictive model.
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 - This example takes the model, svm_train, generated by the function SVMSparse
# and a set of test samples, svm_iris_input_test, and outputs a prediction for each sample.
svm_sparse_predict_result = 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_result.result)
- __repr__(self)
- Returns the string representation for a SVMSparsePredict class instance.
- get_build_time(self)
- Function to return the build time of the algorithm in seconds.
When model object is created using retrieve_model(), then the value returned is
as saved in the Model Catalog.
- get_prediction_type(self)
- Function to return the Prediction type of the algorithm.
When model object is created using retrieve_model(), then the value returned is
as saved in the Model Catalog.
- get_target_column(self)
- Function to return the Target Column of the algorithm.
When model object is created using retrieve_model(), then the value returned is
as saved in the Model Catalog.
- show_query(self)
- Function to return the underlying SQL query.
When model object is created using retrieve_model(), then None is returned.
|