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

Teradata® Package for Python User Guide

Product
Teradata Package for Python
Release Number
17.00
Release Date
November 2021
Content Type
User Guide
Publication ID
B700-4006-070K
Language
English (United States)

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)