INNER CODE UNIT · Python
fit
NorskRegnesentral/skweak · skweak/aggregation.py:84
def fit(self, docs: Iterable[Doc], **kwargs):
"""Fits the parameters of the aggregator model based on a collection
of documents. The method extracts a dataframe of observations for
each document and calls the _fit method"""
obs_generator = (self.get_observation_df(doc) for doc in docs)
self._fit(obs_generator, **kwargs)
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]: