Skip to content

edsnlp.metrics.doc_classif

DocClassificationMetric

Multi-head document classification metric.

Parameters

PARAMETER DESCRIPTION
label_attr

List of Doc._ attributes containing the labels for each head

TYPE: List[str]

micro_key

The key to use to store the micro-averaged results

TYPE: str DEFAULT: 'micro'

macro_key

The key to use to store the macro-averaged results

TYPE: str DEFAULT: 'macro'

filter_expr

The filter expression to use to filter the documents

TYPE: Optional[str] DEFAULT: None

doc_classification_metric [source]

Scores multi-head document-level classification (accuracy, precision, recall, F1) for each head.

Parameters

PARAMETER DESCRIPTION
examples

The examples to score, either a tuple of (golds, preds) or a list of spacy.training.Example objects

TYPE: Union[Tuple[Iterable[Doc], Iterable[Doc]], Iterable[Example]]

label_attr

The list of Doc._ attributes containing the labels for each head

TYPE: List[str]

micro_key

The key to use to store the micro-averaged results

TYPE: str DEFAULT: 'micro'

macro_key

The key to use to store the macro-averaged results

TYPE: str DEFAULT: 'macro'

filter_expr

The filter expression to use to filter the documents

TYPE: Optional[str] DEFAULT: None

RETURNS DESCRIPTION
Dict[str, Dict[str, Any]]

Dictionary mapping head names to their respective metrics