! [ -e /content ] && pip install -Uqq xcube # upgrade xcube on colab
Information Gain
Computation of mutual information gain
This module contains the all classes and functions needed to compute mutual information gain for the tokens and labels. This mutual information is then used to bootstrap a L2R model from xml text data. Please follow the Boot L2R to understand how this module is used.
BatchLbsChunkify
BatchLbsChunkify (chnk_st, chnk_end)
A transform that always take tuples as items
MutualInfoGain
MutualInfoGain (df, bs=8, chnk_sz=200, device=None, lbs_desc=None)
Initialize self. See help(type(self)) for accurate signature.
@property
@patch
def lbs_frqs(self:MutualInfoGain):
= ColReader('labels', label_delim=';')
f self._frqs = Counter()
for o in self.df.itertuples(): self._frqs.update(f(o))
return self._frqs
MutualInfoGain.show
MutualInfoGain.show (*args, save_as=None, **kwargs)