Making Predictions

Notice – All publicly available Indico APIs will be deprecated on Jan 1, 2020

Now your model is ready to predict labels for new data samples. All you need to do is pass a String if you created a text Collection or a Base64 encoded image if you created an image Collection.

The response will be a mapping of the classes you’ve provided to their predicted likelihood. For our photo example, each class is a scene tag, like “nature”, “city”, or “space”.

{"nature": 0.938..., "city": 0.122..., "space": 0.055...}

If you’ve set your data domain to something other than "standard", make sure to pass in the same value when predicting on new examples.

If you’ve trained a Collection for a classification task (predicting which categories text or an image belongs to), the following keyword arguments are supported.

[top_n] – Integer – optionals – only return this many of the most likely topics.

[threshold] – Float (defaults to 0.) – optional – only return topics with likelihood greater than this number.

[independent] – Boolean (defaults to False) – optional – when False, the probabilities of all topics sum to 1, when True, topic probabilities are independent and are not constrained to sum to 1. You must have more than two output categories in order to make use of this flag.

# String data

# Image data
collection.predict("image-url or b64-image")

# Making batch predictions
collection.predict(["string1", "string2", ...])
Annotation Collections

The result format for annotation collections differs from the classification style responses as seen below.

[{'label': 'Named Entity', 'start': 0, 'end': 22, 'confidence': 0.8147523204485575, 'text': 'Advanced Micro Devices'}]