clustering/gmm_lda/gmm/gmm_main.py
def condition(self, indices, x):
        """
        Create a new GMM conditioned on data x at indices.
        """
        condition_comps = []
        marginal_comps = []

        for comp in self.comps:
            condition_comps.append(comp.condition(indices, x))
            marginal_comps.append(comp.marginalize(indices))

        new_priors = []
        for (i,prior) in enumerate(self.priors):
            new_priors.append(prior * marginal_comps[i].pdf(x))
        new_priors = npa(new_priors) / np.sum(new_priors)

        params = {'ncomps' : self.ncomps, 'comps' : condition_comps,
                  'priors' : new_priors, 'dim' : marginal_comps[0].dim}

        return GMM(params = params)

        Create a new GMM conditioned on data x at indices.
        
Create a new GMM conditioned on data x at indices.
Create a new GMM conditioned on data x at indices .
def condition(self, indices, x):
        condition_comps = []
        marginal_comps = []
        for comp in self.comps:
            condition_comps.append(comp.condition(indices, x))
            marginal_comps.append(comp.marginalize(indices))
        new_priors = []
        for (i,prior) in enumerate(self.priors):
            new_priors.append(prior * marginal_comps[i].pdf(x))
        new_priors = npa(new_priors) / np.sum(new_priors)
        params = {'ncomps' : self.ncomps, 'comps' : condition_comps,
                  'priors' : new_priors, 'dim' : marginal_comps[0].dim}
        return GMM(params = params)
def condition ( self , indices , x ) : condition_comps = [ ] marginal_comps = [ ] for comp in self . comps : condition_comps . append ( comp . condition ( indices , x ) ) marginal_comps . append ( comp . marginalize ( indices ) ) new_priors = [ ] for ( i , prior ) in enumerate ( self . priors ) : new_priors . append ( prior * marginal_comps [ i ] . pdf ( x ) ) new_priors = npa ( new_priors ) / np . sum ( new_priors ) params = { 'ncomps' : self . ncomps , 'comps' : condition_comps , 'priors' : new_priors , 'dim' : marginal_comps [ 0 ] . dim } return GMM ( params = params )
Create a new GMM conditioned on data x at indices.
Create a new GMM conditioned on data x at indices .
"""
        Create a new GMM conditioned on data x at indices.
        """
self
indices
x