| |
Methods defined here:
- __init__(self, object=None, newdata=None, attribute_columns=None, sample_id_column=None, accumulate_label=None, output_class_num=None, output_response_probdist=True, output_responses=None, newdata_sequence_column=None, object_sequence_column=None, newdata_order_column=None, object_order_column=None)
- DESCRIPTION:
The SVMDensePredict function takes the model generated by the
function SVMDense and a set of test samples in dense format
and outputs a prediction for each sample.
PARAMETERS:
object:
Required Argument.
Specifies the teradataml DataFrame containing the model
data generated by SVMDense or instance of SVMDense,
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_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)
attribute_columns:
Required Argument.
Specifies the input teradataml DataFrame columns that contain the
attributes of the test samples. Attribute columns must be
numeric (int, real, bigint,smallint, or float).
Python teradataml DataFrame column types accepted: (int, float, long).
Types: str OR list of Strings (str)
sample_id_column:
Required Argument.
Specifies the name of the input teradataml DataFrame column that contains the
identifiers of the test samples.
Types: str
accumulate_label:
Optional Argument.
Columns to be copied from the input teradataml DataFrame to the
output table.
Types: str OR list of Strings (str)
output_class_num:
Optional Argument.
Only valid for multiple class models. If the value of this argument
is k, the output teradataml DataFrame will include k class labels
with corresponding predict_confidence instead of a single predicted
result. The input value must be no less than 1.
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
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.
Default Value: True
Types: bool
output_responses:
Optional Argument.
Specifies responses in the input table.
Note:
1. "output_responses" argument support is only available when teradataml
is connected to Vantage 1.1.1 or later versions.
2. "output_responses" cannot 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)
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 SVMDensePredict.
Output teradataml DataFrames can be accessed using attribute
references, such as SVMDensePredictObj.<attribute_name>.
Output teradataml DataFrame attribute name is:
result
RAISES:
TeradataMlException
EXAMPLES:
# Load the data to run the example.
load_example_data("svmdensepredict", ["nb_iris_input_train","nb_iris_input_test"])
# Create teradataml DataFrame
nb_iris_input_train = DataFrame.from_table("nb_iris_input_train")
nb_iris_input_test = DataFrame.from_table("nb_iris_input_test")
# Example 1 - Linear Model
# Create SVMDense object
svm_dense_out_linear = SVMDense(data = nb_iris_input_train,
sample_id_column = "id",
attribute_columns = ['sepal_length', 'sepal_width' , 'petal_length' , 'petal_width'],
kernel_function = "linear",
label_column = "species",
cost = 1.0,
bias = 0.0,
max_step = 100,
seed = 1
)
svm_dense_predict_out = SVMDensePredict(object = svm_dense_out_linear,
newdata = nb_iris_input_test,
attribute_columns = ['sepal_length', 'sepal_width' , 'petal_length' , 'petal_width'],
sample_id_column = "id",
accumulate_label = ["id","species"]
)
# Print the result DataFrame
print(svm_dense_predict_out)
# Example 2 - polynomial model
svm_dense_out_polynomial = SVMDense(data = nb_iris_input_train,
sample_id_column = "id",
attribute_columns = ['sepal_length', 'sepal_width' , 'petal_length' , 'petal_width'],
kernel_function = "polynomial",
gamma = 0.1,
degree = 2,
subspace_dimension = 120,
hash_bits = 512,
label_column = "species",
cost = 1.0,
bias = 0.0,
max_step = 100,
seed = 1
)
svm_dense_predict_out = SVMDensePredict(object = svm_dense_out_polynomial,
newdata = nb_iris_input_test,
attribute_columns = ['sepal_length', 'sepal_width' , 'petal_length' , 'petal_width'],
sample_id_column = "id",
accumulate_label = ["id","species"]
)
# Print the result DataFrame
print(svm_dense_predict_out)
- __repr__(self)
- Returns the string representation for a SVMDensePredict 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.
|