mindmeld.models.labels module

This module contains classes related to encoding labels for models defined in the models subpackage.

class mindmeld.models.labels.EntityLabelEncoder(config)[source]

Bases: mindmeld.models.labels.LabelEncoder

decode(tags_by_example, **kwargs)[source]

Decodes the labels from the tags passed in for each query

Parameters:
  • tags_by_example (list) -- A list of tags per query
  • kwargs (dict) -- A dict containing at least the "examples" key, which is a list of queries to process
Returns:

A list of decoded labels per query

Return type:

list

encode(labels, **kwargs)[source]

Gets a list of joint app and system IOB tags from each query's entities.

Parameters:
  • labels (list) -- A list of labels associated with each query
  • kwargs (dict) -- A dict containing atleast the "examples" key, which is a list of queries to process
Returns:

A list of list of joint app and system IOB tags from each

query's entities

Return type:

list

class mindmeld.models.labels.LabelEncoder(config)[source]

Bases: object

The label encoder is responsible for converting between rich label objects such as a ProcessedQuery and basic formats a model can interpret.

A MindMeld model uses its label encoder at fit time to encode labels into a form it can deal with, and at predict time to decode predictions into objects

static decode(classes, **kwargs)[source]

Decodes a vector of classes into a list of labels

Parameters:classes (list) -- A list of classes
Returns:The decoded labels
Return type:list
static encode(labels, **kwargs)[source]

Transforms a list of label objects into a vector of classes.

Parameters:labels (list) -- A list of labels to encode