# Path: distributions/dbg/special.py

# 
# Path: distributions/dbg/random.py
# def sample_discrete_log(scores):
#     probs = scores_to_probs(scores)
#     return sample_discrete(probs, total=1.0)


from distributions.dbg.special import log
from distributions.dbg.random import sample_discrete_log
from distributions.mixins import SharedIoMixin

    #-------------------------------------------------------------------------
    # Sampling

    def sample_assignments(self, sample_size):
        '''
        Sample partial assignment vector

            [X_0, ..., X_{n-1}]

        where

            n = sample_size <= N = dataset_size.
        '''
        assert sample_size <= self.dataset_size

        assignments = []
        counts = []
        scores = []
        bogus = 0

        for size in xrange(sample_size):

            score_empty = self.score_add_value(0, bogus, size)
            if len(counts) == 0 or counts[-1] != 0:
                counts.append(0)
                scores.append(score_empty)
            else:
                scores[-1] = score_empty


# Path: distributions/dbg/special.py

# 
# Path: distributions/dbg/random.py
# def sample_discrete_log(scores):
#     probs = scores_to_probs(scores)
#     return sample_discrete(probs, total=1.0)


# Path: distributions/dbg/clustering.py
from distributions.dbg.special import log
from distributions.dbg.random import sample_discrete_log
from distributions.mixins import SharedIoMixin


    #-------------------------------------------------------------------------
    # Sampling

    def sample_assignments(self, sample_size):
        '''
        Sample partial assignment vector

            [X_0, ..., X_{n-1}]

        where

            n = sample_size <= N = dataset_size.
        '''
        assert sample_size <= self.dataset_size

        assignments = []
        counts = []
        scores = []
        bogus = 0

        for size in xrange(sample_size):

            score_empty = self.score_add_value(0, bogus, size)
            if len(counts) == 0 or counts[-1] != 0:
                counts.append(0)
                scores.append(score_empty)
            else:
                scores[-1] = score_empty


            assign = sample_discrete_log(scores)