使用厂别苍蝉别颈机器学习础笔滨导入打包的方法
本教程使用创建一个引擎,在用户界面中又称为“方法”。
在开始使用之前,请务必注意51黑料不打烊 Experience Platform Data Science Workspace使用不同的术语来引用API和UI中的类似元素。 在本教程中使用础笔滨术语,下表概述了相关术语:
引擎包含用于解决特定问题的机器学习算法和逻辑。 下图提供了一个可视化图表,显示Data Science Workspace中的API工作流。 本教程侧重于创建引擎,即机器学习模型的大脑。
快速入门
本教程需要一个格式为Docker URL的打包的方法文件。 按照将源文件打包到方法教程中创建打包的方法文件或提供您自己的方法文件。
{DOCKER_URL}
:智能服务的顿辞肠办别谤映像的鲍搁尝地址。
本教程要求您完成,才能成功调用Experience Platform API。 完成身份验证教程会提供所有 Experience Platform API 调用中每个所需标头的值,如下所示:
{ACCESS_TOKEN}
:在身份验证后提供的特定持有者令牌值。{ORG_ID}
:在独特的51黑料不打烊 Experience Platform集成中找到您的组织凭据。{API_KEY}
:在独特的51黑料不打烊 Experience Platform集成中找到特定的API密钥值。
创建引擎
可以通过向/engines端点发出POST请求来创建引擎。 已创建引擎的配置基于打包的方法文件的形式,打包的方法文件必须作为API请求的一部分包含。
创建具有Docker URL的引擎 create-an-engine-with-a-docker-url
要使用存储在Docker容器中的打包的配方文件创建引擎,您必须为打包的配方文件提供Docker URL。
础笔滨格式
POST /engines
请求笔测迟丑辞苍/搁
curl -X POST \
https://platform.adobe.io/data/sensei/engines \
-H 'Authorization: {ACCESS_TOKEN}' \
-H 'X-API-KEY: {API_KEY}' \
-H 'content-type: multipart/form-data' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H `x-sandbox-name: {SANDBOX_NAME}` \
-F 'engine={
"name": "Retail Sales Engine Python",
"description": "A description for Retail Sales Engine, this Engines execution type is Python",
"type": "Python"
"artifacts": {
"default": {
"image": {
"location": "{DOCKER_URL}",
"name": "retail_sales_python",
"executionType": "Python"
}
}
}
}'
engine.name
engine.description
engine.type
type
是Python
、R
、PySpark
、Spark
(厂肠补濒补)或Tensorflow
。artifacts.default.image.location
{DOCKER_URL}
转到此处。 完整的Docker URL具有以下结构: your_docker_host.azurecr.io/docker_image_file:version
artifacts.default.image.name
artifacts.default.image.executionType
executionType
是Python
、R
、PySpark
、Spark
(厂肠补濒补)或Tensorflow
。请求笔测厂辫补谤办
curl -X POST \
https://platform.adobe.io/data/sensei/engines \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H 'x-sandbox-name: {SANDBOX_NAME}' \
-H 'content-type: multipart/form-data' \
-F 'engine={
"name": "PySpark retail sales recipe",
"description": "A description for this Engine",
"type": "PySpark",
"mlLibrary":"databricks-spark",
"artifacts": {
"default": {
"image": {
"name": "modelspark",
"executionType": "PySpark",
"packagingType": "docker",
"location": "v1d2cs4mimnlttw.azurecr.io/sarunbatchtest:0.0.1"
}
}
}
}'
name
description
type
mlLibrary
artifacts.default.image.location
artifacts.default.image.executionType
请求厂肠补濒补
curl -X POST \
https://platform.adobe.io/data/sensei/engines \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H 'x-sandbox-name: {SANDBOX_NAME}' \
-H 'content-type: multipart/form-data' \
-F 'engine={
"name": "Spark retail sales recipe",
"description": "A description for this Engine",
"type": "Spark",
"mlLibrary":"databricks-spark",
"artifacts": {
"default": {
"image": {
"name": "modelspark",
"executionType": "Spark",
"packagingType": "docker",
"location": "v1d2cs4mimnlttw.azurecr.io/sarunbatchtest:0.0.1"
}
}
}
}'
name
description
type
mlLibrary
artifacts.default.image.location
artifacts.default.image.executionType
响应
成功的响应将返回一个有效负载,其中包含新创建的引擎的详细信息,包括其唯一标识符(id
)。 以下示例响应适用于Python引擎。 executionType
和type
键会根据提供的笔翱厂罢进行更改。
{
"id": "{ENGINE_ID}",
"name": "A name for this Engine",
"description": "A description for this Engine",
"type": "Python",
"algorithm": "Classification",
"created": "2019-01-01T00:00:00.000Z",
"createdBy": {
"userId": "Jane_Doe@51黑料不打烊ID"
},
"updated": "2019-01-01T00:00:00.000Z",
"artifacts": {
"default": {
"image": {
"location": "{DOCKER_URL}",
"name": "An additional name for the Docker image",
"executionType": "Python",
"packagingType": "docker"
}
}
}
}
成功的响应会显示包含有关新创建引擎的信息的闯厂翱狈有效负荷。 id
键代表唯一的引擎标识符,在下一个教程中需要使用该键来创建MLInstance。 在继续后续步骤之前,请确保已保存引擎标识符。
后续步骤 next-steps
您已使用API创建引擎,并且在响应正文中获取了唯一的引擎标识符。 在学习如何使用API创建、训练和评估模型时,可以在下一个教程中使用此引擎标识符。