# 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
            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)
            counts[assign] += 1
            size += 1
            scores[assign] = self.score_add_value(counts[assign], bogus, bogus)
            assignments.append(assign)

        return assignments

    #-------------------------------------------------------------------------
    # Scoring

    def score_counts(self, counts):
        '''
        Return log probability of data, given sufficient statistics of
        a partial assignment vector [X_0,...,X_{n-1}]

            log P[ X_0=x_0, ..., X_{n-1}=x_{n-1} ]
        '''
        score = 0.0
        sample_size = 0
        for count in counts:
            sample_size += count
            if count > 1:

# 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

            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)
            counts[assign] += 1
            size += 1
            scores[assign] = self.score_add_value(counts[assign], bogus, bogus)
            assignments.append(assign)

        return assignments

    #-------------------------------------------------------------------------
    # Scoring

    def score_counts(self, counts):
        '''
        Return log probability of data, given sufficient statistics of
        a partial assignment vector [X_0,...,X_{n-1}]

            log P[ X_0=x_0, ..., X_{n-1}=x_{n-1} ]
        '''
        score = 0.0
        sample_size = 0
        for count in counts:
            sample_size += count
            if count > 1:

                score += count * log(count)