您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

使用 Azure 机器学习设计器运行批量预测(预览版)Run batch predictions using Azure Machine Learning designer (preview)

应用于:否基本版是企业版            (升级到企业版APPLIES TO: noBasic edition yesEnterprise edition                       (Upgrade to Enterprise)

本文介绍如何使用设计器创建批量预测管道。In this article, you learn how to use the designer to create a batch prediction pipeline. 批量预测使你能够按需使用可从任何 HTTP 库触发的 Web 服务持续为大型数据集评分。Batch prediction lets you continuously score large datasets on-demand using a web service that can be triggered from any HTTP library.

本操作指南将介绍如何执行以下任务:In this how-to, you learn to do the following tasks:

  • 创建并发布批量推理管道Create and publish a batch inference pipeline
  • 使用管道终结点Consume a pipeline endpoint
  • 管理终结点版本Manage endpoint versions

若要了解如何使用 SDK 设置批量评分服务,请参阅随附的操作指南To learn how to set up batch scoring services using the SDK, see the accompanying how-to.

必备条件Prerequisites

本操作指南假设已有了一个训练管道。This how-to assumes you already have a training pipeline. 有关设计器的引导式介绍,请参阅设计器教程的第一部分For a guided introduction to the designer, complete part one of the designer tutorial.

创建批量推理管道Create a batch inference pipeline

必须至少运行训练管道一次,才能创建推断管道。Your training pipeline must be run at least once to be able to create an inferencing pipeline.

  1. 转到工作区中的“设计器”选项卡。 Go to the Designer tab in your workspace.

  2. 选择训练管道,该管道将训练用于做出预测的模型。Select the training pipeline that trains the model you want to use to make prediction.

  3. 提交管道。Submit the pipeline.

    提交管道

运行训练管道后,接下来可以创建批量推理管道。Now that the training pipeline has been run, you can create a batch inference pipeline.

  1. 在 "提交" 旁边,选择新的 dropdown Create 推理管道Next to Submit, select the new dropdown Create inference pipeline.

  2. 选择“批量推理管道”。 Select Batch inference pipeline.

    创建批量推理管道

结果为默认批量推理管道。The result is a default batch inference pipeline.

添加管道参数Add a pipeline parameter

若要对新数据创建预测,可以在此管道草稿视图中手动连接一个不同的数据集,或者创建数据集的参数。To create predictions on new data, you can either manually connect a different dataset in this pipeline draft view or create a parameter for your dataset. 参数可以在运行时更改批量推理过程的行为。Parameters let you change the behavior of the batch inferencing process at runtime.

在本部分,你将创建一个数据集参数,用于指定预测时所要针对的不同数据集。In this section, you create a dataset parameter to specify a different dataset to make predictions on.

  1. 选择数据集模块。Select the dataset module.

  2. 画布右侧将显示一个窗格。A pane will appear to the right of the canvas. 在该窗格的底部,选择“设为管道参数”。 At the bottom of the pane, select Set as pipeline parameter.

    输入参数的名称,或接受默认值。Enter a name for the parameter, or accept the default value.

发布批量推断管道Publish your batch inferencing pipeline

现已准备好部署推断管道。Now you're ready to deploy the inferencing pipeline. 此操作将部署该管道,并使其可供其他人使用。This will deploy the pipeline and make it available for others to use.

  1. 选择“发布”按钮 。Select the Publish button.

  2. 在显示的对话框中,展开“管道终结点”对应的下拉列表,然后选择“新建管道终结点”。 In the dialog that appears, expand the drop-down for PipelineEndpoint, and select New PipelineEndpoint.

  3. 提供终结点的名称和可选说明。Provide an endpoint name and optional description.

    在对话框底部附近,可以看到使用训练期间通过数据集 ID 默认值配置的参数。Near the bottom of the dialog, you can see the parameter you configured with a default value of the dataset ID used during training.

  4. 选择“发布” 。Select Publish.

发布管道

使用终结点Consume an endpoint

现已发布一个具有数据集参数的管道。Now, you have a published pipeline with a dataset parameter. 该管道将使用训练管道中创建的已训练模型来评分以参数形式提供的数据集。The pipeline will use the trained model created in the training pipeline to score the dataset you provide as a parameter.

提交管道运行Submit a pipeline run

在本部分,你将设置一个手动管道运行,并更改管道参数,以便为新数据评分。In this section, you will set up a manual pipeline run and alter the pipeline parameter to score new data.

  1. 部署完成后,转到“终结点”部分。 After the deployment is complete, go to the Endpoints section.

  2. 选择“管道终结点”。 Select Pipeline endpoints.

  3. 选择创建的终结点的名称。Select the name of the endpoint you created.

终结点链接

  1. 选择“已发布的管道”。 Select Published pipelines.

    此屏幕将显示此终结点下发布的所有管道。This screen shows all published pipelines published under this endpoint.

  2. 选择你发布的管道。Select the pipeline you published.

    管道详细信息页将显示该管道的详细运行历史记录和连接字符串信息。The pipeline details page shows you a detailed run history and connection string information for your pipeline.

  3. 选择 "提交" 以创建管道的手动运行。Select Submit to create a manual run of the pipeline.

    管道详细信息

  4. 更改参数以使用不同的数据集。Change the parameter to use a different dataset.

  5. 选择 "提交" 以运行管道。Select Submit to run the pipeline.

使用 REST 终结点Use the REST endpoint

可以在“终结点”部分找到有关如何使用管道终结点和已发布管道的信息。 You can find information on how to consume pipeline endpoints and published pipeline in the Endpoints section.

可以在运行概述面板中找到管道终结点的 REST 终结点。You can find the REST endpoint of a pipeline endpoint in the run overview panel. 调用终结点即会使用其默认的已发布管道。By calling the endpoint, you are consuming its default published pipeline.

也可以在“已发布的管道”页中使用已发布的管道。 You can also consume a published pipeline in the Published pipelines page. 选择已发布的管道,并查找其 REST 终结点。Select a published pipeline and find the REST endpoint of it.

REST 终结点详细信息

若要发出 REST 调用,需要 OAuth 2.0 持有者类型身份验证标头。To make a REST call, you will need an OAuth 2.0 bearer-type authentication header. 请参阅以下教程部分,以详细了解如何设置工作区的身份验证并进行参数化 REST 调用。See the following tutorial section for more detail on setting up authentication to your workspace and making a parameterized REST call.

对终结点进行版本控制Versioning endpoints

设计器会将一个版本分配给要发布到终结点的每个后续管道。The designer assigns a version to each subsequent pipeline that you publish to an endpoint. 可以指定要在 REST 调用中作为参数执行的管道版本。You can specify the pipeline version that you want to execute as a parameter in your REST call. 如果未指定版本号,设计器将使用默认管道。If you don't specify a version number, the designer will use the default pipeline.

发布管道时,可以选择将其设为该终结点的新默认管道。When you publish a pipeline, you can choose to make it the new default pipeline for that endpoint.

设置默认管道

也可以在终结点的“已发布的管道”选项卡中设置新的默认管道。 You can also set a new default pipeline in the Published pipelines tab of your endpoint.

设置默认管道

后续步骤Next steps

按照设计器教程训练和部署回归模型。Follow the designer tutorial to train and deploy a regression model. ''''