reconer.insights

The reconer.insights module provides more complex functionality for understanding your dataset. It provides functions for identifying disparities in your annotations and identifying the kinds of examples and labels that are hardest for your model to identify.

Some of the functionality in reconer.insights require a reconer.recognizer.EntityRecognizer object. You can read more about the EntityRecognizer class here: Tutorial - Custom EntityRecognizer


API

reconer.insights.ents_by_label(data, use_lower=True)

Get a dictionary of unique text spans by label for your data

Parameters


data: (List[Example]), required.

List of Examples

use_lower: (bool, optional), Defaults to True.

Use the lowercase form of the span text

Returns


(DefaultDict[str, List[str]]):

DefaultDict mapping label to sorted list of the unique

spans annotated for that label.
reconer.insights.get_label_disparities(data, label1, label2, use_lower=True)

Identify annotated spans that have different labels in different examples

Parameters


data: (List[Example]), required.

Input List of Examples

label1: (str), required.

First label to compare

label2: (str), required.

Second label to compare

Returns


(Set[str]):

Set of all unique text spans that overlap between label1 and label2
reconer.insights.top_prediction_errors(ner, data, labels=None, k=None, exclude_fp=False, exclude_fn=False)

Get a sorted list of examples your model is worst at predicting.

Parameters


ner: (EntityRecognizer), required.

An instance of EntityRecognizer

data: (List[Example]), required.

List of annotated Examples

labels: (List[str], optional), Defaults to None.

List of labels to get errors for. Defaults to the labels property of ner.

k: (int, optional), Defaults to None.

If set, return the top k prediction errors, otherwise the whole list.

exclude_fp: (bool, optional), Defaults to False.

Flag to exclude False Positive errors.

exclude_fn: (bool, optional), Defaults to False.

Flag to exclude False Negative errors.

Returns


(List[PredictionError]):

[description]