Azure 机器学习工作室(经典)Web 服务:部署和使用Azure Machine Learning Studio (classic) Web Services: Deployment and consumption

适用于: yes机器学习工作室(经典) noAzure 机器学习APPLIES TO: yesMachine Learning Studio (classic) noAzure Machine Learning

可以使用 Azure 机器学习工作室(经典)将机器学习工作流和模型作为 Web 服务部署。You can use Azure Machine Learning Studio (classic) to deploy machine learning workflows and models as web services. 然后,可以使用这些 Web 服务,通过 Internet 从应用程序调用机器学习模型,从而实时或者在批处理模式下进行预测。These web services can then be used to call the machine learning models from applications over the Internet to do predictions in real time or in batch mode. 由于 Web 服务是 RESTful,可以从各种编程语言和平台(如 .NET 和 Java)以及应用程序(如 Excel)调用它们。Because the web services are RESTful, you can call them from various programming languages and platforms, such as .NET and Java, and from applications, such as Excel.

接下来的部分提供指向演练、代码和文档的链接,可帮助你开始操作。The next sections provide links to walkthroughs, code, and documentation to help get you started.

部署 Web 服务Deploy a web service

使用 Azure 机器学习工作室(经典)With Azure Machine Learning Studio (classic)

工作室(经典)门户和 Microsoft Azure 机器学习 Web 服务门户可帮助部署和管理 Web 服务,而无需编写代码。The Studio (classic) portal and the Microsoft Azure Machine Learning Web Services portal help you deploy and manage a web service without writing code.

以下链接提供有关如何部署新 Web 服务的常规信息:The following links provide general Information about how to deploy a new web service:

使用 Web 服务资源提供程序 API (Azure 资源管理器 API)With web services resource provider APIs (Azure Resource Manager APIs)

用于 Web 服务的 Azure 机器学习工作室(经典)资源提供程序支持使用 REST API 调用来部署和管理 Web 服务。The Azure Machine Learning Studio (classic) resource provider for web services enables deployment and management of web services by using REST API calls. 有关详细信息,请参阅机器学习 Web 服务 (REST) 参考。For more information, see the Machine Learning Web Service (REST) reference.

使用 PowerShell cmdletWith PowerShell cmdlets

用于 Web 服务的 Azure 机器学习工作室(经典)资源提供程序支持使用 PowerShell cmdlet 来部署和管理 Web 服务。The Azure Machine Learning Studio (classic) resource provider for web services enables deployment and management of web services by using PowerShell cmdlets.

要使用 cmdlet,必须先使用 Connect-AzAccount cmdlet 从 PowerShell 环境中登录到 Azure 帐户。To use the cmdlets, you must first sign in to your Azure account from within the PowerShell environment by using the Connect-AzAccount cmdlet. 如果对调用基于资源管理器的 PowerShell 命令不熟悉,请参阅将 Azure PowerShell 与 Azure 资源管理器配合使用If you are unfamiliar with how to call PowerShell commands that are based on Resource Manager, see Using Azure PowerShell with Azure Resource Manager.

若要导出预测实验,则使用此代码示例To export your predictive experiment, use this sample code. 从代码创建 .exe 文件后,可以键入:After you create the .exe file from the code, you can type:

C:\<folder>\GetWSD <experiment-url> <workspace-auth-token>

运行应用程序将创建 Web 服务 JSON 模板。Running the application creates a web service JSON template. 若要使用模板部署 Web 服务,必须添加以下信息:To use the template to deploy a web service, you must add the following information:

在与 MachineLearningWorkspace 节点相同的级别上,将它们添加到 JSON 模板作为 Properties 节点的子节点。Add them to the JSON template as children of the Properties node at the same level as the MachineLearningWorkspace node.

下面是一个示例:Here's an example:

"StorageAccount": {
        "name": "YourStorageAccountName",
        "key": "YourStorageAccountKey"
},
"CommitmentPlan": {
    "id": "subscriptions/YouSubscriptionID/resourceGroups/YourResourceGroupID/providers/Microsoft.MachineLearning/commitmentPlans/YourPlanName"
}

有关更多详细信息,请参阅以下文章和示例代码:See the following articles and sample code for additional details:

使用 Web 服务Consume the web services

从 Azure 机器学习 Web 服务 UI(测试)From the Azure Machine Learning Web Services UI (Testing)

可以从 Azure 机器学习 Web 服务门户测试 Web 服务。You can test your web service from the Azure Machine Learning Web Services portal. 这包括测试请求-响应服务 (RRS) 和批处理执行服务 (BES) 接口。This includes testing the Request-Response service (RRS) and Batch Execution service (BES) interfaces.

从 ExcelFrom Excel

可以下载使用 Web 服务的 Excel 模板:You can download an Excel template that consumes the web service:

从基于 REST 的客户端From a REST-based client

Azure 机器学习 Web 服务是 RESTful API。Azure Machine Learning Web Services are RESTful APIs. 可以从各种平台使用这些 API,例如 .NET、Python、R、Java 等。Microsoft Azure 机器学习 Web 服务门户上的 Web 服务“使用”页提供示例代码,从而有助于开始操作。You can consume these APIs from various platforms, such as .NET, Python, R, Java, etc. The Consume page for your web service on the Microsoft Azure Machine Learning Web Services portal has sample code that can help you get started. 有关详细信息,请参阅如何使用 Azure 机器学习 Web 服务For more information, see How to consume an Azure Machine Learning Web service.