deploy() Method | teradataml Azure Extension Library |API Integration - deploy() Method - Deploying Azure Machine Learning Model - Teradata Vantage

Teradata Vantageā„¢ - API Integration Guide for Cloud Machine Learning

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Teradata Vantage
Release Number
1.4
Published
September 2023
Language
English (United States)
Last Update
2023-09-28
dita:mapPath
mgu1643999543506.ditamap
dita:ditavalPath
ayr1485454803741.ditaval
dita:id
mgu1643999543506

Use the deploy() method to deploy given Azure Machine Learning models to Vantage, by downloading the model from Azure Machine Learning and saving it to Vantage. User also has the option to deploy the model in Azure Machine Learning itself as an online endpoint.

deploy() method belongs to <RunConfig> object obtained by invoking tdapiclient.<RunConfig>.

Required Arguments:
  • model: Specifies Azure Machine Learning model.
  • model_type: Specifies the type of the model:
    • 'pmml'
    • 'onnx'
    • 'h2o'
  • platform: Specifies the platform to which the given model will be deployed:
    • 'vantage'
    • 'az-webservice'
Optional Arguments:
  • model_id: Specifies the id of the model for Teradata table.

    If no value is given, the id of the given Azure Machine Learning model will be used.

  • save_byom_kwargs: Specifies the keyword arguments of teradataml save_byom() function.

    If neither table_name is provided nor BYOM catalog set using set_byom_catalog, a table with name 'tdapiclient_byom_models' will be created in the current schema.

  • retrieve_byom_kwargs: Specifies the keyword arguments of teradataml retrieve_byom() function.
  • model_deploy_kwargs: Specifies the keyword arguments to deploy the Azure Machine Learning webservice.

Examples

  • Import necessary packages.
    from tdapiclient import create_tdapi_context, TDApiClient
  • Create the TDAPI context.
    context = create_tdapi_context("azure", "/td-tables")
  • Create TDApiClient object.
    tdapiclient = TDApiClient(context)
  • Create teradataml DataFrame.
    train = DataFrame(tableName='train_data')
  • Create a SKLearn model.

    ScriptRunConfig takes all the parameters as required by Azure Machine Learning ScriptRunConfig.

    skLearnObject = tdapiclient.ScriptRunConfig(arguments=[train])
  • Train the model in Azure Machine Learning.
    run = skLearnObject.fit(mount=True)
  • Register the model in Azure Machine Learning.
    model = run.register_model(model_name='example', model_path='outputs/example.pmml')
  • Deploy model.
    Based on the location to deploy the model, use different setting for platform:
    • To deploy to Vantage (requires BYOM), use:
      model_predictor = skLearnObject.deploy(model, model_type="pmml", platform="vantage")
    • To deploy to Azure Machine Learning, use:
      model_predictor = skLearnObject.deploy(model="pmml", platform="az-webservice")