引擎端點
引擎是資料科學工作區中機器學習模型的基礎。 它們包含解決特定問題的機器學習演演算法、執行特徵工程的特徵配管或兩者。
查詢您的Docker登錄檔
需要Docker登入認證才能上傳封裝的配方檔案,包括您的Docker主機URL、使用者名稱和密碼。 您可以透過執行以下GET請求來查詢此資訊:
API格式
GET /engines/dockerRegistry
要求
curl -X GET https://platform.adobe.io/data/sensei/engines/dockerRegistry \
-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}'
回應
成功的回應會傳回包含Docker登入詳細資訊的裝載,包括Docker URL (host
),使用者名稱(username
)和密碼(password
)。
{ACCESS_TOKEN}
已更新。{
"host": "docker_host.azurecr.io",
"username": "00000000-0000-0000-0000-000000000000",
"password": "password"
}
使用Docker URL建立引擎 docker-image
您可以透過執行POST請求來建立引擎,同時提供其中繼資料以及參照多部分表單中Docker影像的Docker URL。
API格式
POST /engines
要求Python/R
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": "A name for this Engine",
"description": "A description for this Engine",
"type": "Python",
"algorithm": "Classification",
"artifacts": {
"default": {
"image": {
"location": "v1rsvj32smc4wbs.azurecr.io/ml-featurepipeline-pyspark:1.0",
"name": "An additional name for the Docker image",
"executionType": "Python"
}
}
}
}'
name
description
type
algorithm
artifacts.default.image.location
artifacts.default.image.executionType
請求PySpark/Scala
請求PySpark配方時, executionType
和 type
為「PySpark」。 請求Scala配方時, executionType
和 type
為「Spark」。 下列Scala配方範例使用Spark:
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
databricks-spark
.artifacts.default.image.location
artifacts.default.image.executionType
回應
成功的回應會傳回裝載,其中包含新建立之引擎的詳細資訊,包括其唯一識別碼(id
)。 以下範例回應適用於Python引擎。 所有引擎回應都遵循此格式:
{
"id": "22f4166f-85ba-4130-a995-a2b8e1edde32",
"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@AdobeID"
},
"updated": "2019-01-01T00:00:00.000Z",
"artifacts": {
"default": {
"image": {
"location": "v1rsvj32smc4wbs.azurecr.io/ml-featurepipeline-pyspark:1.0",
"name": "An additional name for the Docker image",
"executionType": "Python",
"packagingType": "docker"
}
}
}
}
使用Docker URL建立功能管道引擎 feature-pipeline-docker
您可以透過執行POST請求來建立功能管道引擎,同時提供其中繼資料和參考Docker影像的Docker URL。
API格式
POST /engines
要求
curl -X POST \
https://platform.adobe.io/data/sensei/engines \
-H 'Authorization: Bearer ' \
-H 'x-gw-ims-org-id: 20655D0F5B9875B20A495E23@AdobeOrg' \
-H 'Content-Type: application/vnd.adobe.platform.sensei+json;profile=engine.v1.json' \
-H 'x-api-key: acp_foundation_machineLearning' \
-H 'Content-Type: text/plain' \
-F '{
"type": "PySpark",
"algorithm":"fp",
"name": "Feature_Pipeline_Engine",
"description": "Feature_Pipeline_Engine",
"mlLibrary": "databricks-spark",
"artifacts": {
"default": {
"image": {
"location": "v7d1cs2mimnlttw.azurecr.io/ml-featurepipeline-pyspark:0.2.1",
"name": "datatransformation",
"executionType": "PySpark",
"packagingType": "docker"
},
"defaultMLInstanceConfigs": [ ...
]
}
}
}'
type
algorithm
fp
(特徵管線)。name
description
mlLibrary
databricks-spark
.artifacts.default.image.location
artifacts.default.image.executionType
artifacts.default.image.packagingType
docker
.artifacts.default.defaultMLInstanceConfigs
pipeline.json
組態檔引數。回應
成功的回應會傳回承載,其中包含新建立功能管道引擎的詳細資訊,包括其唯一識別碼(id
)。 下列範例回應適用於PySpark特徵配管引擎。
{
"id": "88236891-4309-4fd9-acd0-3de7827cecd1",
"name": "Feature_Pipeline_Engine",
"description": "Feature_Pipeline_Engine",
"type": "PySpark",
"algorithm": "fp",
"mlLibrary": "databricks-spark",
"created": "2020-04-24T20:46:58.382Z",
"updated": "2020-04-24T20:46:58.382Z",
"deprecated": false,
"artifacts": {
"default": {
"image": {
"location": "v7d1cs3mimnlttw.azurecr.io/ml-featurepipeline-pyspark:0.2.1",
"name": "datatransformation",
"executionType": "PySpark",
"packagingType": "docker"
},
"defaultMLInstanceConfigs": [ ... ]
}
}
}
擷取引擎清單
您可以透過執行單一GET請求來擷取引擎清單。 若要協助篩選結果,您可以在請求路徑中指定查詢引數。 如需可用查詢的清單,請參閱 用於資產擷取的查詢引數.
API格式
GET /engines
GET /engines?parameter_1=value_1
GET /engines?parameter_1=value_1¶meter_2=value_2
要求
curl -X GET \
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}'
回應
成功的回應會傳回引擎清單及其詳細資料。
{
"children": [
{
"id": "22f4166f-85ba-4130-a995-a2b8e1edde31",
"name": "A name for this Engine",
"description": "A description for this Engine",
"type": "PySpark",
"algorithm": "Classification",
"created": "2019-01-01T00:00:00.000Z",
"createdBy": {
"userId": "Jane_Doe@AdobeID"
},
"updated": "2019-01-01T00:00:00.000Z"
},
{
"id": "22f4166f-85ba-4130-a995-a2b8e1edde32",
"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@AdobeID"
},
"updated": "2019-01-01T00:00:00.000Z"
},
{
"id": "22f4166f-85ba-4130-a995-a2b8e1edde33",
"name": "Feature Pipeline Engine",
"description": "A feature pipeline Engine",
"type": "PySpark",
"algorithm":"fp",
"created": "2019-01-01T00:00:00.000Z",
"createdBy": {
"userId": "Jane_Doe@AdobeID"
},
"updated": "2019-01-01T00:00:00.000Z"
}
],
"_page": {
"property": "deleted==false",
"totalCount": 100,
"count": 3
}
}
擷取特定引擎 retrieve-specific
您可以透過執行GET請求(包含請求路徑中所需引擎的ID)來擷取特定引擎的詳細資訊。
API格式
GET /engines/{ENGINE_ID}
{ENGINE_ID}
要求
curl -X GET \
https://platform.adobe.io/data/sensei/engines/22f4166f-85ba-4130-a995-a2b8e1edde32 \
-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}'
回應
成功的回應會傳回包含所需引擎詳細資訊的裝載。
{
"id": "22f4166f-85ba-4130-a995-a2b8e1edde32",
"name": "A name for this Engine",
"description": "A description for this Engine",
"type": "PySpark",
"algorithm": "Classification",
"created": "2019-01-01T00:00:00.000Z",
"createdBy": {
"userId": "Jane_Doe@AdobeID"
},
"updated": "2019-01-01T00:00:00.000Z",
"artifacts": {
"default": {
"image": {
"location": "v7d1cs2mimnlttw.azurecr.io/ml-featurepipeline-pyspark:0.2.1",
"name": "file.egg",
"executionType": "PySpark",
"packagingType": "docker"
}
}
}
}
更新引擎
您可以透過PUT請求(請求路徑中包含目標引擎的ID)來覆寫現有引擎的屬性,並提供包含已更新屬性的JSON裝載,藉此修改和更新現有引擎。
以下範例API呼叫最初具有這些屬性時會更新引擎的名稱和說明:
{
"name": "A name for this Engine",
"description": "A description for this Engine",
"type": "Python",
"algorithm": "Classification",
"artifacts": {
"default": {
"image": {
"executionType": "Python",
"packagingType": "docker"
}
}
}
}
API格式
PUT /engines/{ENGINE_ID}
{ENGINE_ID}
要求
curl -X PUT \
https://platform.adobe.io/data/sensei/engines/22f4166f-85ba-4130-a995-a2b8e1edde32 \
-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: application/vnd.adobe.platform.sensei+json;profile=engine.v1.json' \
-d '{
"name": "An updated name for this Engine",
"description": "An updated description",
"type": "Python",
"algorithm": "Classification",
"artifacts": {
"default": {
"image": {
"executionType": "Python",
"packagingType": "docker"
}
}
}
}'
回應
成功的回應會傳回包含引擎更新詳細資料的裝載。
{
"id": "22f4166f-85ba-4130-a995-a2b8e1edde32",
"name": "An updated name for this Engine",
"description": "An updated description",
"type": "Python",
"algorithm": "Classification",
"created": "2019-01-01T00:00:00.000Z",
"createdBy": {
"displayName": "Jane Doe",
"userId": "Jane_Doe@AdobeID"
},
"updated": "2019-01-02T00:00:00.000Z",
"artifacts": {
"default": {
"image": {
"executionType": "Python",
"packagingType": "docker"
}
}
}
}
刪除引擎
您可以在請求路徑中指定DELETE引擎的ID時,透過執行目標請求來刪除引擎。 刪除引擎將會階層式刪除參照該引擎的所有MLInstances,包括屬於這些MLInstances的所有實驗與實驗執行。
API格式
DELETE /engines/{ENGINE_ID}
{ENGINE_ID}
要求
curl -X DELETE \
https://platform.adobe.io/data/sensei/engines/22f4166f-85ba-4130-a995-a2b8e1edde32 \
-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}'
回應
{
"title": "Success",
"status": 200,
"detail": "Engine deletion was successful"
}