MLServices端点
MLService是一个已发布的经过训练的模型,使您的组织能够访问和重复使用以前开发的模型。 MLServices的主要功能是能够按计划自动进行训练和评分。 计划的训练运行有助于保持模型的效率和准确性,而计划的得分运行可以确保始终如一地生成新见解。
自动训练和评分计划定义有开始时间戳、结束时间戳和以cron表达式表示的频率。 可以在创建MLService或由更新现有MLService应用时定义计划。
创建MLService create-an-mlservice
您可以通过执行POST请求和提供服务的名称和有效MLInstance ID的有效负载来创建MLService。 用于创建MLService的MLInstance不需要具有现有的训练实验,但您可以通过提供相应的实验ID和训练运行ID,选择使用现有的训练模型创建MLService。
API格式
POST /mlServices
请求
curl -X POST \
https://platform.adobe.io/data/sensei/mlServices \
-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=mlService.v1.json' \
-d '{
"name": "A name for this MLService",
"description": "A description for this MLService",
"mlInstanceId": "46986c8f-7739-4376-8509-0178bdf32cda",
"trainingDataSetId": "5ee3cd7f2d34011913c56941",
"trainingExperimentId": "014d8acf-08fb-421c-8b65-760c8799c627",
"trainingExperimentRunId": "33408593-2871-4198-a812-6d1b7d939cda",
"trainingSchedule": {
"startTime": "2019-01-01T00:00",
"endTime": "2019-12-31T00:00",
"cron": "20 * * * *"
},
"scoringSchedule": {
"startTime": "2019-01-01T00:00",
"endTime": "2019-12-31T00:00",
"cron": "20 * * * *"
}
}'
name
description
mlInstanceId
trainingDataSetId
trainingExperimentId
trainingExperimentRunId
trainingSchedule
trainingSchedule.startTime
trainingSchedule.endTime
trainingSchedule.cron
scoringSchedule
scoringSchedule.startTime
scoringSchedule.endTime
scoringSchedule.cron
响应
成功的响应将返回一个有效负载,其中包含新创建的MLService的详细信息,包括其唯一标识符(id
)、用于训练的试验ID (trainingExperimentId
)、用于评分的试验ID (scoringExperimentId
)以及输入训练数据集ID (trainingDataSetId
)。
{
"id": "68d936d8-17e6-44ef-a4b6-c7502055638b",
"name": "A name for this MLService",
"description": "A description for this MLService",
"mlInstanceId": "46986c8f-7739-4376-8509-0178bdf32cda",
"trainingExperimentId": "014d8acf-08fb-421c-8b65-760c8799c627",
"trainingDataSetId": "5ee3cd7f2d34011913c56941",
"scoringExperimentId": "76c2b1b-fad7-4b31-8c54-19ecc18b1ea0",
"created": "2019-01-01T00:00:00.000Z",
"createdBy": {
"userId": "Jane_Doe@AdobeID"
},
"trainingSchedule": {
"startTime": "2019-01-01T00:00",
"endTime": "2019-12-31T00:00",
"cron": "20 * * * *"
},
"scoringSchedule": {
"startTime": "2019-01-01T00:00",
"endTime": "2019-12-31T00:00",
"cron": "20 * * * *"
},
"updated": "2019-01-01T00:00:00.000Z"
}
检索MLServices列表 retrieve-a-list-of-mlservices
您可以通过执行单个GET请求来检索MLServices列表。 要帮助筛选结果,您可以在请求路径中指定查询参数。 有关可用查询的列表,请参阅用于资源检索的查询参数的附录部分。
API格式
GET /mlServices
GET /mlServices?{QUERY_PARAMETER}={VALUE}
GET /mlServices?{QUERY_PARAMETER_1}={VALUE_1}&{QUERY_PARAMETER_2}={VALUE_2}
请求
以下请求包含一个查询,并检索共享同一MLInstance ID ({MLINSTANCE_ID}
)的MLServices列表。
curl -X GET \
'https://platform.adobe.io/data/sensei/mlServices?property=mlInstanceId==46986c8f-7739-4376-8509-0178bdf32cda' \
-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}'
响应
成功的响应返回MLServices及其详细信息,包括其MLService ID ({MLSERVICE_ID}
)、用于训练的试验ID ({TRAINING_ID}
)、用于评分的试验ID ({SCORING_ID}
)以及输入训练数据集ID ({DATASET_ID}
)。
{
"children": [
{
"id": "68d936d8-17e6-44ef-a4b6-c7502055638b",
"name": "A service created in UI",
"mlInstanceId": "46986c8f-7739-4376-8509-0178bdf32cda",
"trainingExperimentId": "014d8acf-08fb-421c-8b65-760c8799c627",
"trainingDataSetId": "5ee3cd7f2d34011913c56941",
"scoringExperimentId": "76c2b1b-fad7-4b31-8c54-19ecc18b1ea0",
"created": "2019-01-01T00:00:00.000Z",
"createdBy": {
"displayName": "Jane Doe",
"userId": "Jane_Doe@AdobeID"
},
"updated": "2019-01-01T00:00:00.000Z"
}
],
"_page": {
"property": "mlInstanceId==46986c8f-7739-4376-8509-0178bdf32cda,deleted==false",
"count": 1
}
}
检索特定MLService retrieve-a-specific-mlservice
您可以通过执行GET请求(请求路径中包含所需的MLService ID)来检索特定试验的详细信息。
API格式
GET /mlServices/{MLSERVICE_ID}
{MLSERVICE_ID}
:有效的MLService ID。
请求
curl -X GET \
https://platform.adobe.io/data/sensei/mlServices/68d936d8-17e6-44ef-a4b6-c7502055638b \
-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}'
响应
成功的响应将返回包含所请求MLService的详细信息的有效负载。
{
"id": "68d936d8-17e6-44ef-a4b6-c7502055638b",
"name": "A name for this MLService",
"description": "A description for this MLService",
"mlInstanceId": "46986c8f-7739-4376-8509-0178bdf32cda",
"trainingExperimentId": "014d8acf-08fb-421c-8b65-760c8799c627",
"trainingDataSetId": "5ee3cd7f2d34011913c56941",
"scoringExperimentId": "76c2b1b-fad7-4b31-8c54-19ecc18b1ea0",
"created": "2019-01-01T00:00:00.000Z",
"createdBy": {
"userId": "Jane_Doe@AdobeID"
},
"updated": "2019-01-01T00:00:00.000Z"
}
更新MLService update-an-mlservice
您可以更新现有的MLService,方法是通过PUT请求(请求路径中包含目标MLService的ID)覆盖其属性,并提供包含已更新属性的JSON有效负载。
API格式
PUT /mlServices/{MLSERVICE_ID}
{MLSERVICE_ID}
:有效的MLService ID。
请求
curl -X PUT \
https://platform.adobe.io/data/sensei/mlServices/68d936d8-17e6-44ef-a4b6-c7502055638b \
-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=mlService.v1.json' \
-d '{
"name": "A name for this MLService",
"description": "A description for this MLService",
"mlInstanceId": "46986c8f-7739-4376-8509-0178bdf32cda",
"trainingExperimentId": "014d8acf-08fb-421c-8b65-760c8799c627",
"trainingDataSetId": "5ee3cd7f2d34011913c56941",
"scoringExperimentId": "76c2b1b-fad7-4b31-8c54-19ecc18b1ea0",
"trainingSchedule": {
"startTime": "2019-01-01T00:00",
"endTime": "2019-12-31T00:00",
"cron": "20 * * * *"
},
"scoringSchedule": {
"startTime": "2019-01-01T00:00",
"endTime": "2019-12-31T00:00",
"cron": "20 * * * *"
}
}'
响应
成功的响应将返回包含MLService更新详细信息的有效负载。
{
"id": "68d936d8-17e6-44ef-a4b6-c7502055638b",
"name": "A name for this MLService",
"description": "A description for this MLService",
"mlInstanceId": "46986c8f-7739-4376-8509-0178bdf32cda",
"trainingExperimentId": "014d8acf-08fb-421c-8b65-760c8799c627",
"trainingDataSetId": "5ee3cd7f2d34011913c56941",
"scoringExperimentId": "76c2b1b-fad7-4b31-8c54-19ecc18b1ea0",
"created": "2019-01-01T00:00:00.000Z",
"createdBy": {
"userId": "Jane_Doe@AdobeID"
},
"trainingSchedule": {
"startTime": "2019-01-01T00:00",
"endTime": "2019-12-31T00:00",
"cron": "20 * * * *"
},
"scoringSchedule": {
"startTime": "2019-01-01T00:00",
"endTime": "2019-12-31T00:00",
"cron": "20 * * * *"
},
"updated": "2019-01-02T00:00:00.000Z"
}
删除MLService
通过执行DELETE路径中包含目标MLService ID的请求,可以删除单个MLService。
API格式
DELETE /mlServices/{MLSERVICE_ID}
{MLSERVICE_ID}
请求
curl -X DELETE \
https://platform.adobe.io/data/sensei/mlServices/68d936d8-17e6-44ef-a4b6-c7502055638b \
-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": "MLService deletion was successful"
}
按MLInstance ID删除MLServices
通过执行将MLInstance ID指定为查询参数的DELETE请求,可以删除属于特定MLInstance的所有MLServices。
API格式
DELETE /mlServices?mlInstanceId={MLINSTANCE_ID}
{MLINSTANCE_ID}
请求
curl -X DELETE \
https://platform.adobe.io/data/sensei/mlServices?mlInstanceId=46986c8f-7739-4376-8509-0178bdf32cda \
-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": "MLServices deletion was successful"
}