byom_install_location | Teradata Package for Python - byom_install_location - Teradata Package for Python

Teradata® Package for Python User Guide

Product
Teradata Package for Python
Release Number
17.00
Published
November 2021
Language
English (United States)
Last Update
2022-01-14
dita:mapPath
bol1585763678431.ditamap
dita:ditavalPath
ayr1485454803741.ditaval
dita:id
B700-4006
lifecycle
previous
Product Category
Teradata Vantage

The byom_install_location configuration option indicates the name of the database where Bring Your Own Model functions are installed. This option is internally used by BYOM functions like H2OPredict() and PMMLPredict().

Example

  • Import all modules.
    >>> from teradataml import *
  • Set the configuration option byom_install_location to "mldb".
    >>> # Set the teradataml Configuration option 'byom_install_location' to "mldb"
    >>> configure.byom_install_location = "mldb"
  • Load example data.
    >>> load_example_data("byom", "iris_test")
  • Load model files.
    >>> # Load model file into Vantage.
    >>> model_file = os.path.join(os.path.dirname(teradataml.__file__), "data", "models", "iris_mojo_glm_h2o_model")
  • Save the model.
    >>> save_byom("iris_mojo_glm_h2o_model", model_file, "byom_models")
  • Retrieve the saved model and directly pass the output as an input to the H2OPredict function.
    >>> modeldata = retrieve_byom("iris_mojo_glm_h2o_model", table_name="byom_models")
    >>> result = H2OPredict(newdata=iris_test,
                            newdata_partition_column='id',
                            newdata_order_column='id',
                            modeldata=modeldata,
                            modeldata_order_column='model_id',
                            model_output_fields=['label', 'classProbabilities'],
                            accumulate=['id', 'sepal_length', 'petal_length'],
                            overwrite_cached_models='*',
                            enable_options='stageProbabilities',
                            model_type='OpenSource'
                           )
  • Print the results of the H2OPredict function.
    >>> # Print the results.
    >>> print(result.result)