Example #1
0
    def __init__(self,
                 components,
                 alpha_0=None,
                 a_0=None,
                 b_0=None,
                 weights=None,
                 weights_obj=None):
        assert len(components) > 0
        assert (alpha_0 is not None) ^ (a_0 is not None and b_0 is not None) \
                ^ (weights_obj is not None)

        self.components = components

        if alpha_0 is not None:
            self.weights = Categorical(alpha_0=alpha_0,
                                       K=len(components),
                                       weights=weights)
        elif weights_obj is not None:
            self.weights = weights_obj
        else:
            self.weights = CategoricalAndConcentration(a_0=a_0,
                                                       b_0=b_0,
                                                       K=len(components),
                                                       weights=weights)

        self.labels_list = []