Skip to content

Cascade

CascadeEnsemble

Bases: EnsembleBase

Ensemble method that iterates over the annotations and picks the first annotation that is not unannotated.

Source code in src/ensemble/cascade.py
 8
 9
10
11
12
13
14
15
16
17
18
19
class CascadeEnsemble(EnsembleBase):
    """
    Ensemble method that iterates over the annotations and picks the first annotation that is not unannotated.
    """

    def run(self, annotations: List[Annotation]) -> Annotation:
        for annotation in annotations:
            if not annotation.unannotated:
                return Annotation(distribution=annotation.distribution,
                                  unannotated=0)

        return Annotation(distribution=annotations[0].distribution, unannotated=1)