Adding Data

Let’s say we have a list of 4,000 images labeled with the scene they were taken in. If you’re working in JavaScript or you don’t have URLs or filenames for your images, you need to Base64 encode them first, which can be done in your programming language of choice or online.

Now we can send the data along with our labels as shown at below. Your Collection is going to attempt to learn patterns that associate the labels you provide with the data they correspond to.

Other Collection Types
Arugments

The domain argument
If you’re trying to build a Collection similar to one of indico’s existing text APIs, you may be able to improve your Collection’s performance by adapting one of our models to your domain’s use case. Currently, the following settings are valid for the domain argument:

For Text:

  • "standard" – general text analysis problems
  • "topics" – text classification problems similar to Text Tags
  • "sentiment" – sentiment analysis and related problems
  • "finance" – financial news and reports
  • "elmo" – features described in “Deep contextualized word representations” by Peters, et al.
  • "ensemble" – a blend of multiple domains

For Annotation:

  • "standard" – general text analysis problems
  • "sentiment" – sentiment analysis and related problems
  • "finance" – financial news and reports
  • "elmo" – features described in “Deep contextualized word representations” by Peters, et al.

For Images:

  • "standard" – defaults to “image_v3”
  • "image_v2" – VGG-style CNN features
  • "image_v3" – CNN features with spatial pyramid pooling
  • "image_v4" – Inception-style CNN features

The save_for_explanations argument
If True, save raw text to enable calling collection.explain() later

The metadata argument
Associate JSON metadata with example for explain() functionality later

Adding data does not count towards your monthly call volume.

# String data
collection.add_data(["string", "label"])

# Image data
collection.add_data(["image-url or b64-image", "label"])

# Batch add data
collection.add_data([["string1", "label1"], ["string2", "label2"]])

# Specifying domain
collection.add_data([["string1", "label1"], ["string2", "label2"]], {domain: "topics"})