Skip to content

Avg

AverageEnsemble

Bases: EnsembleBase

Ensemble method that averages the annotations.

Source code in src/ensemble/avg.py
10
11
12
13
14
15
16
17
18
19
20
class AverageEnsemble(EnsembleBase):
    """
    Ensemble method that averages the annotations.
    """
    def run(self, annotations: List[Annotation]) -> Tuple[Union[List | np.array], int]:
        annotated = np.array([x.distribution for x in annotations if not x.unannotated])
        if annotated:
            mean = np.mean(annotated, axis=0)
            return mean, 0

        return annotations[0], 1