INNER CODE UNIT · Python
fit_and_aggregate
NorskRegnesentral/skweak · skweak/aggregation.py:101
def fit_and_aggregate(self, docs: Iterable[Doc]) -> Iterable[Doc]:
"""Starts by fitting the parameters of the aggregator (if necessary)
then applies the resulting model to aggregate the outputs of the
labelling functions."""
docs = list(docs)
self.fit(docs)
return list(self.pipe(docs))
@abstractmethod
def get_observation_df(self, doc: Doc):
"""Returns a dataframe containing the observed predictions of each labelling
sources for the document. The dataframe has one row per unique span for span
labelling, and one row per token for sequence labelling."""
raise NotImplementedError("must implement get_observation_df")