INNER CODE UNIT · Python
_fit
NorskRegnesentral/skweak · skweak/aggregation.py:93
def _fit(self, all_obs:Iterable[pandas.DataFrame], **kwargs):
"""Fits the parameters of the aggregator model based on a collection
of (span or token-level) observations extracted from documents. If
not overriden, the method assumes the model does not contain any
parameters, and does nothing"""
pass
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))