return Counter(self.label_encoder.inverse_transform(target_arrs))
def _dataset_with_targets(self, Xs, Y, train, context=None):
if context is None:
context = [None] * len(Xs)
if not callable(Xs) and not callable(Y):
dataset = lambda: zip(Xs, Y, context)
elif callable(Xs) and callable(Y):
dataset = lambda: zip(Xs(), Y(), context)
After Change
else:
if not callable(Xs) and not callable(Y):
dataset = lambda: zip(Xs, Y)
elif callable(Xs) and callable(Y):
dataset = lambda: zip(Xs(), Y())
else:
raise ValueError( "Either neither or both of Xs and Y should be callable, not a mixture")
dataset_encoded = lambda: itertools.chain.from_iterable(
map(lambda xy: self.text_to_tokens_mask(*xy), dataset())