INNER CODE UNIT · Python
aggregate
NorskRegnesentral/skweak · skweak/aggregation.py:134
def aggregate(self, obs: pandas.DataFrame) -> pandas.DataFrame:
"""Takes as input a 2D dataframe of shape (nb_entries, nb_sources)
associating each token/span to a set of observations from labelling
sources, and returns a 2D dataframe of shape (nb_entries, nb_labels)
assocating each entry to the probability of each output label.
"""
raise NotImplementedError("must implement aggregate")
@abstractmethod
def _get_spans(self, agg_df: pandas.DataFrame, threshold=0.5) \
-> List[Tuple[int,int,str]]:
"""Takes as input a 2D dataframe of shape (nb_entries, nb_labels)
assocating each token/span to the probability of an output label, and
returns a list of tuples (start, end, label).
"""
raise NotImplementedError("must implement _get_spans")