added total to lequa protocols for bag iteration

This commit is contained in:
Alejandro Moreo Fernandez 2026-03-03 10:06:08 +01:00
parent 5374ef3cae
commit 1907c040ad
1 changed files with 7 additions and 0 deletions

View File

@ -99,6 +99,9 @@ class SamplesFromDir(AbstractProtocol):
sample, _ = self.load_fn(os.path.join(self.path_dir, f'{id}.txt'))
yield sample, prevalence
def total(self):
return len(self.true_prevs)
class LabelledCollectionsFromDir(AbstractProtocol):
@ -113,6 +116,10 @@ class LabelledCollectionsFromDir(AbstractProtocol):
lc = LabelledCollection.load(path=collection_path, loader_func=self.load_fn)
yield lc
def total(self):
return len(self.true_prevs)
class ResultSubmission: