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

Teradata® Package for Python Function Reference

Product
Teradata Package for Python
Release Number
17.00
Published
November 2021
Language
English (United States)
Last Update
2021-11-19
lifecycle
previous
Product Category
Teradata Vantage

 
teradataml.analytics.mle.GLML1L2Predict = class GLML1L2Predict(builtins.object)
     Methods defined here:
__init__(self, modeldata=None, newdata=None, accumulate=None, output_prob=False, output_responses=None, newdata_sequence_column=None, modeldata_sequence_column=None, newdata_order_column=None, modeldata_order_column=None)
DESCRIPTION:
    The GLML1L2Predict function uses the model output by the GLML1L2 
    function to perform generalized linear model prediction on new input 
    data.
 
 
PARAMETERS:
    modeldata:
        Required Argument.
        Specifies the teradataml DataFrame which contains the model 
        data generated by the GLML1L2 function or instance of GLML1L2.
 
    modeldata_order_column:
        Optional Argument.
        Specifies Order By columns for modeldata.
        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 test data set.
    
    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)
    
    accumulate:
        Optional Argument.
        Specifies the names of input teradataml DataFrame columns to copy to 
        the output.
        Types: str OR list of Strings (str)
    
    output_prob:
        Optional Argument.
        Specifies whether to output probabilities or not.
        Note: "output_prob" argument support is only available
              when teradataml is connected to Vantage 1.1 or later.
        Default Value: False
        Types: bool
    
    output_responses:
        Optional Argument.
        Specifies responses in the input teradataml DataFrame.
        output_prob must be set to True in order to use this argument.
        Note: "output_responses" argument support is only available
              when teradataml is connected to Vantage 1.1.1 or later.
        Permitted Values: 0, 1
        Types: str OR list of strs
    
    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)
    
    modeldata_sequence_column:
        Optional Argument.
        Specifies the list of column(s) that uniquely identifies each row of 
        the input argument "modeldata". 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 GLML1L2Predict.
    Output teradataml DataFrames can be accessed using attribute 
    references, such as GLML1L2PredictObj.<attribute_name>.
    Output teradataml DataFrame attribute name is:
        result
 
 
RAISES:
    TeradataMlException
 
 
EXAMPLES:
    # Load the data to run the example.
    load_example_data("GLMPredict", ["admissions_test","admissions_train","housing_test","housing_train"])
 
    # Create teradataml DataFrame objects.
    admissions_test = DataFrame.from_table("admissions_test")
    admissions_train = DataFrame.from_table("admissions_train")
    housing_test = DataFrame.from_table("housing_test")
    housing_train = DataFrame.from_table("housing_train")
 
    # Example 1 -
    # Generate a model based on train data "admissions_train" & Ridge Regression, Family ('BINOMIAL').
    glml1l2_out = GLML1L2(data=admissions_train,
                          formula = "admitted ~ masters + gpa + stats + programming",
                          alpha=0.0,
                          lambda1=0.02,
                          family='Binomial',
                          randomization=True
                         )
 
    # Use the generated model to predict the 'admissions' on the test data
    # admissions_test by using generated model by GLM.
    glml1l2_predict_out1 =  GLML1L2Predict(modeldata = glml1l2_out,
                                           newdata = admissions_test,
                                           accumulate = "id",
                                           output_prob=True
                                          )
 
    # Print the result DataFrame.
    print(glml1l2_predict_out1.result)
 
    # Example 2 - Generate a model based on train data "housing_train" & LASSO, Family ('GAUSSIAN').
    glml1l2_out_hs = GLML1L2(data=housing_train ,
                             formula = "price ~ lotsize + bedrooms + bathrms + stories + garagepl + driveway + recroom + fullbase + gashw + airco + prefarea + homestyle",
                             alpha=1.0,
                             lambda1=0.02,
                             family='Gaussian'
                            )
 
    # Use the generated model to predict the 'price' on the test data
    # housing_test by using generated model by GLM.
    glml1l2_predict_out2 = GLML1L2Predict(modeldata = glml1l2_out_hs.output,
                                          newdata = housing_test,
                                          accumulate = "sn"
                                         )
 
    # Print the result.
    print(glml1l2_predict_out2)
__repr__(self)
Returns the string representation for a GLML1L2Predict 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.