Teradata Package for Python Function Reference - save_model - 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.catalog.model_cataloging.save_model = save_model(model, name, description, model_project=None, entity_target=None, performance_metrics=None)
DESCRIPTION:
    Function to save a teradataml Analytic Function model in Teradata Vantage.
 
PARAMETERS:
    model:
        Required Argument.
        Specifies the teradataml analytic function model to be saved.
        Types: teradataml analytic function object.
 
    name:
        Required Argument.
        Specifies the unique name to identify the saved model.
        The maximum length of the name is 128 characters.
        Types: str
 
    description:
        Required Argument.
        Specifies a note describing the model to be saved.
        The maximum length of the description is 1024 characters.
        Types: str
 
    model_project:
        Optional Argument.
        Specifies the project that the model is associated with.
        The maximum length of the model_project is 128 characters.
        Types: str
        Default Value: None
 
    entity_target:
        Optional Argument.
        Specifies a group or team that the model is associated with.
        The maximum length of the entity_target is 128 characters.
        Types: str
        Default Value: None
 
    performance_metrics:
        Optional Argument.
        Specifies the performance metrics for the model.
        performance_metrics must be a dictionary of the following form:
            { "<metric>" : { "measure" : <value> }, ... }
        For example:
            { "AUC" : { "measure" : 0.5 }, ... }
        The value should be of type float.
        Types: dict
        Default Value: None
 
RETURNS:
    None.
 
RAISES:
    TeradataMlException, TypeError, ValueError
 
EXAMPLES:
    # Load the data to run the example
    load_example_data("decisionforest", ["housing_train"])
 
    # Create teradataml DataFrame objects.
    housing_train = DataFrame.from_table("housing_train")
 
    # This example uses home sales data to create a
    # classification tree that predicts home style, which can be input
    # to the DecisionForestPredict.
    formula = "homestyle ~ driveway + recroom + fullbase + gashw + airco + prefarea + price + lotsize + bedrooms + bathrms + stories + garagepl"
    rft_model = DecisionForest(data=housing_train,
                               formula = formula,
                               tree_type="classification",
                               ntree=50,
                               tree_size=100,
                               nodesize=1,
                               variance=0.0,
                               max_depth=12,
                               maxnum_categorical=20,
                               mtry=3,
                               mtry_seed=100,
                               seed=100
                               )
 
    # Let's save this generated model.
    save_model(model=rft_model, name="decision_forest_model", description="Decision Forest test")