Adding Data – Multi-label

Use this model type when any number of the supplied labels can apply to each example (i.e. each label is independent from the others). This is equivalent to training a separate classifier to predict whether or not each possible label applies to a provided document. The probabilities returned by a call to `predict()` can each range from 0. to 1. and are not required to sum to 1. Examples of multi-label classification include predicting the topics an article covers or predicting what themes a user mentioned in a review.

In this case you can supply multiple labels per data point when adding data to your custom collection.

// String data
collection.addData(["string1", ["label-1", "label-2"]])
  .then(console.log);

// Image data
collection.addData(["image-url or b64-image", ["label-1", "label-2"]])
  .then(console.log);

// Batch add data
collection.addData(
    [
        ["string1", ["label-1"]], 
        ["string2", ["label-2"]], 
        ["string3", ["label-1", "label-2" ]],
        ["string4", []]
    ]
).then(console.log);

// Specifying domain
collection.addData(
    [
        ["string1", ["label-1"]], 
        ["string2", ["label-2"]], 
        ["string3", ["label-1", "label-2" ]],
        ["string4", []]
    ], 
    {domain: "topics"}
).then(console.log);