Classification Predictions
Predictions are suggestions for how products might be classified. The following examples show the format of the service requests and responses. The service API is documented in detail in Swagger available at https://app.stibosystems.com/ds/mlac/v1.
The prediction resource https://app.stibosystems.com/ds/mlac/v1/predict accepts POST requests with a JSON message body.
In STEP, the predict request can be sent from a business action via a gateway integration endpoint. For more information, refer to the topics in this section:
Example Request
The request can contain information about a single or multiple unclassified products. Responses are synchronous with a number of classification predictions for each product.
The request body format is:
{
"products": [
{
"id": "string",
"sourceId": "string",
"description": "string"
}
]
}
The request body fields are:
- 'id' - Mandatory. Required for each product.
- 'description' - Optional. A description can improve the accuracy of predictions.
- 'sourceId' - Optional. A source ID should only be populated if it is significant for the classification and if it is supplied when uploading already classified products.
The request query parameters are:
- 'hierarchyIds' - Specifies the hierarchies that should be used to generate predictions. The hierarchy IDs provided must match the IDs used when uploading hierarchies and training products.
- 'maxSuggestionsPerHierarchy' - Optional. Limits how many predictions are returned for each hierarchy.
Example Response
A response for a single product, for two hierarchies with IDs ‘primary’ and ‘gs’ with ‘maxSuggestionsPerHierarchy’ set to 2, could look as follows:
{
"predictions": [
{
"id": "ABC-123",
"hierarchies": [
{
"hierarchyId": "primary",
"predictions": [
{
"classificationId": "Lvl4-16772",
"confidence": 92
},
{
"classificationId": "Lvl4-16723",
"confidence": 72
}
]
},
{
"hierarchyId": "gs",
"predictions": [
{
"classificationId": "Bike Wheels",
"confidence": 95
},
{
"classificationId": "Bike Wheel Parts",
"confidence": 69
}
]
}
]
}
]
}
Notice that each prediction is accompanied with a confidence number indicating how confident the service is about the prediction.