MLInstances endpoint
An MLInstance is a pairing of an existing Engine with an appropriate set of configurations that defines any training parameters, scoring parameters, or hardware resource configurations.
Create an MLInstance create-an-mlinstance
You can create an MLInstance by performing a POST request while providing a request payload consisting of a valid Engine ID ({ENGINE_ID}
) and an appropriate set of default configurations.
If the Engine ID references a PySpark or Spark Engine then you have the ability to configure the amount of computation resources such as the number of cores or the amount of memory. If a Python Engine is referenced then you can choose between using either a CPU or GPU for training and scoring purposes. Refer to the appendix sections on PySpark and Spark resource configurations and Python CPU and GPU configurations for more information.
API Format
POST /mlInstances
Request
curl -X POST \
https://platform.adobe.io/data/sensei/mlInstances \
-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=mlInstance.v1.json' \
-d '{
"name": "A name for this MLInstance",
"description": "A description for this MLInstance",
"engineId": "22f4166f-85ba-4130-a995-a2b8e1edde32",
"tasks": [
{
"name": "train",
"parameters": [
{
"key": "training parameter",
"value": "parameter value"
}
]
},
{
"name": "score",
"parameters": [
{
"key": "scoring parameter",
"value": "parameter value"
}
]
},
{
"name": "fp",
"parameters": [
{
"key": "feature pipeline parameter",
"value": "parameter value"
}
]
}
],
}'
name
description
engineId
tasks
Response
A successful response returns a payload containing the details of the newly created MLInstance including its unique identifier (id
).
{
"id": "46986c8f-7739-4376-8509-0178bdf32cda",
"name": "A name for this MLInstance",
"description": "A description for this MLInstance",
"engineId": "22f4166f-85ba-4130-a995-a2b8e1edde32",
"created": "2019-01-01T00:00:00.000Z",
"createdBy": {
"userId": "Jane_Doe@AdobeID"
},
"updated": "2019-01-01T00:00:00.000Z",
"tasks": [
{
"name": "train",
"parameters": [
{
"key": "training parameter",
"value": "parameter value"
}
]
},
{
"name": "score",
"parameters": [
{
"key": "scoring parameter",
"value": "parameter value"
}
]
},
{
"name": "fp",
"parameters": [
{
"key": "feature pipeline parameter",
"value": "parameter value"
}
]
}
]
}
Retrieve a list of MLInstances
You can retrieve a list of MLInstances by performing a single GET request. To help filter results, you can specify query parameters in the request path. For a list of available queries, refer to the appendix section on query parameters for asset retrieval.
API Format
GET /mlInstances
GET /mlInstances?{QUERY_PARAMETER}={VALUE}
GET /mlInstances?{QUERY_PARAMETER_1}={VALUE_1}&{QUERY_PARAMETER_2}={VALUE_2}
{QUERY_PARAMETER}
{VALUE}
Request
curl -X GET \
https://platform.adobe.io/data/sensei/mlInstances \
-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}'
Response
A successful response returns a list of MLInstances and their details.
{
"children": [
{
"id": "46986c8f-7739-4376-8509-0178bdf32cda",
"name": "A name for this MLInstance",
"description": "A description for this MLInstance",
"engineId": "22f4166f-85ba-4130-a995-a2b8e1edde32",
"created": "2019-01-01T00:00:00.000Z",
"createdBy": {
"displayName": "Jane Doe",
"userId": "Jane_Doe@AdobeID"
},
"updated": "2019-01-01T00:00:00.000Z"
},
{
"id": "56986c8f-7739-4376-8509-0178bdf32cda",
"name": "Retail Sales Model",
"description": "A Model created with the Retail Sales Recipe",
"engineId": "32f4166f-85ba-4130-a995-a2b8e1edde32",
"created": "2019-01-01T00:00:00.000Z",
"createdBy": {
"displayName": "Jane Doe",
"userId": "Jane_Doe@AdobeID"
},
"updated": "2019-01-01T00:00:00.000Z"
}
],
"_page": {
"property": "deleted==false",
"totalCount": 2,
"count": 2
}
}
Retrieve a specific MLInstance retrieve-specific
You can retrieve the details of a specific MLInstance by performing a GET request that includes the ID of the desired MLInstance in the request path.
API Format
GET /mlInstances/{MLINSTANCE_ID}
{MLINSTANCE_ID}
Request
curl -X GET \
https://platform.adobe.io/data/sensei/mlInstances/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}'
Response
A successful response returns the details of the MLInstance.
{
"id": "46986c8f-7739-4376-8509-0178bdf32cda",
"name": "A name for this MLInstance",
"description": "A description for this MLInstance",
"engineId": "22f4166f-85ba-4130-a995-a2b8e1edde32",
"created": "2019-01-01T00:00:00.000Z",
"createdBy": {
"displayName": "Jane Doe",
"userId": "Jane_Doe@AdobeID"
},
"updated": "2019-01-01T00:00:00.000Z",
"tasks": [
{
"name": "train",
"parameters": [
{
"key": "training parameter",
"value": "parameter value"
}
]
},
{
"name": "score",
"parameters": [
{
"key": "scoring parameter",
"value": "parameter value"
}
]
},
{
"name": "featurePipeline",
"parameters": [
{
"key": "feature pipeline parameter",
"value": "parameter value"
}
]
}
]
}
Update an MLInstance
You can update an existing MLInstance by overwriting its properties through a PUT request that includes the target MLInstance’s ID in the request path and providing a JSON payload containing updated properties.
The following sample API call will update an MLInstance’s training and scoring parameters while having these properties initially:
{
"name": "A name for this MLInstance",
"description": "A description for this MLInstance",
"engineId": "00000000-0000-0000-0000-000000000000",
"created": "2019-01-01T00:00:00.000Z",
"createdBy": {
"displayName": "Jane Doe",
"userId": "Jane_Doe@AdobeID"
},
"tasks": [
{
"name": "train",
"parameters": [
{
"key": "learning_rate",
"value": "0.3"
}
]
},
{
"name": "score",
"parameters": [
{
"key": "output_dataset_id",
"value": "output-dataset-000"
}
]
}
]
}
API Format
PUT /mlInstances/{MLINSTANCE_ID}
{MLINSTANCE_ID}
Request
curl -X PUT \
https://platform.adobe.io/data/sensei/mlInstances/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}' \
-H 'content-type: application/vnd.adobe.platform.sensei+json;profile=mlInstance.v1.json' \
-d '{
"name": "A name for this MLInstance",
"description": "A description for this MLInstance",
"engineId": "00000000-0000-0000-0000-000000000000",
"created": "2019-01-01T00:00:00.000Z",
"createdBy": {
"displayName": "Jane Doe",
"userId": "Jane_Doe@AdobeID"
},
"tasks": [
{
"name": "train",
"parameters": [
{
"key": "learning_rate",
"value": "0.5"
}
]
},
{
"name": "score",
"parameters": [
{
"key": "output_dataset_id",
"value": "output-dataset-001"
}
]
}
]
}'
Response
A successful response returns a payload containing the MLInstance’s updated details.
{
"id": "46986c8f-7739-4376-8509-0178bdf32cda",
"name": "A name for this MLInstance",
"description": "A description for this MLInstance",
"engineId": "00000000-0000-0000-0000-000000000000",
"created": "2019-01-01T00:00:00.000Z",
"createdBy": {
"displayName": "Jane Doe",
"userId": "Jane_Doe@AdobeID"
},
"updated": "2019-01-02T00:00:00.000Z",
"tasks": [
{
"name": "train",
"parameters": [
{
"key": "learning_rate",
"value": "0.5"
}
]
},
{
"name": "score",
"parameters": [
{
"key": "output_dataset_id",
"value": "output-data-set-001"
}
]
}
]
}
Delete MLInstances by Engine ID
You can delete all MLInstances sharing the same Engine by performing a DELETE request that includes the Engine ID as a query parameter.
API Format
DELETE /mlInstances?engineId={ENGINE_ID}
{ENGINE_ID}
Request
curl -X DELETE \
https://platform.adobe.io/data/sensei/mlInstances?engineId=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}'
Response
{
"title": "Success",
"status": 200,
"detail": "MLInstances successfully deleted"
}
Delete an MLInstance
You can delete a single MLInstance by performing a DELETE request that includes the target MLInstance’s ID in the request path.
API Format
DELETE /mlInstances/{MLINSTANCE_ID}
{MLINSTANCE_ID}
Request
curl -X DELETE \
https://platform.adobe.io/data/sensei/mlInstances/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}'
Response
{
"title": "Success",
"status": 200,
"detail": "MLInstance deletion was successful"
}