Skip to main content
Version: 1.40

Custom IDs for predictions

When the generated prediction ID is not sufficient for the needs of your specific use case, you can define an custom ID. The custom ID attached to the request is used to handle and filter all the predictions in a better way.

The custom ID essentially allows you to define a key-value pair, where the key is the custom IDs name, and the values are submitted with a prediction.

example

You predict XYZ for your clients. You want to be able to easily group predictions for a single client. In this case, you might define a custom ID named 'ClientId', where the values are the clients' names, to easily achieve this.

Set up a custom ID

The custom ID for a Deployment can be configured in the metadata.json within the Repository.

Include the custom ID in a request

After setting up a custom ID, you can include it inside requests using the specified format. Note that the instances key may be replaced with inputs.

{
"instances": [
<value>
],
"<customIdName>": [
<value>
]
}

For the 'clientId' example, the request would look like this:

{
"instances": [
[6.8, 2.8, 4.8, 1.4],
[6.0, 3.4, 4.5, 1.6]
],
"clientId": [
"Client A",
"Client B"
]
}

In this example, each custom ID inside clientId array is linked to the corresponding prediction instance.

note

Including a custom ID in a request is optional, even when you have defined a custom ID for the Deployment. If no custom ID is included in a request, everything works in the same fashion as Deployments without the custom ID.

Filter by custom ID

In the Predictions page of a Deployment, you can filter prediction logs by custom ID. Next to the time period definition fields, there will be a field with your custom ID name as it's title.

tip

The custom ID field has autocomplete functionality. As you type, matching suggestions will show up.

Update a custom ID

If you decide to update the Custom ID, predictions made with the previous Custom ID will still have their original ID. However, any new request made will require the new Custom ID to be included in the call, e.g. You've set up a Custom ID called 'ClientId', made a few request with it and now decide to change it to 'CustomerId'. Your previous prediction logs will still keep their value in the prediction log overview, and you'll still be able to filter the previous predictions based on the 'Customer'