nussl/ml/unfold/gaussian_mixture.py
def forward(self, data, means=None, covariance=None):
        """
        Does a forward pass of the GMM.
        
        Args:
            data (torch.Tensor): Data, shape is (n_batch, ..., n_features)
            means (torch.Tensor): Means, shape (n_batch, n_components, n_features). 
              Defaults to None.
            covariance (torch.Tensor): (n_batch, n_components, n_features, n_features) 
              or (n_batch, n_components, n_features). 
        
        Returns:
            dict: Containing keys 'resp', 'log_prob', 'means', 'covariance', 'prior'.
        """
        shape = data.shape
        data = data.view(shape[0], -1, shape[-1])
        means, covariance = self.init_params(data, means, covariance)

        resp = log_prob = prior = None
        for i in range(self.n_iter):
            resp, log_prob = self._e_step(data, means, covariance)
            means, covariance, prior = self._m_step(data, resp)

        return {
            'resp': resp.view(shape[:-1] + (-1,)),
            'log_prob': log_prob.view(shape[:-1] + (-1,)),
            'means': means,
            'covariance': covariance,
            'prior': prior
        }

        Does a forward pass of the GMM.
        
        Args:
            data (torch.Tensor): Data, shape is (n_batch, ..., n_features)
            means (torch.Tensor): Means, shape (n_batch, n_components, n_features). 
              Defaults to None.
            covariance (torch.Tensor): (n_batch, n_components, n_features, n_features) 
              or (n_batch, n_components, n_features). 
        
        Returns:
            dict: Containing keys 'resp', 'log_prob', 'means', 'covariance', 'prior'.
        
Does a forward pass of the GMM.
Does a forward pass of the GMM .
def forward(self, data, means=None, covariance=None):
        shape = data.shape
        data = data.view(shape[0], -1, shape[-1])
        means, covariance = self.init_params(data, means, covariance)
        resp = log_prob = prior = None
        for i in range(self.n_iter):
            resp, log_prob = self._e_step(data, means, covariance)
            means, covariance, prior = self._m_step(data, resp)
        return {
            'resp': resp.view(shape[:-1] + (-1,)),
            'log_prob': log_prob.view(shape[:-1] + (-1,)),
            'means': means,
            'covariance': covariance,
            'prior': prior
        }
def forward ( self , data , means = None , covariance = None ) : shape = data . shape data = data . view ( shape [ 0 ] , - 1 , shape [ - 1 ] ) means , covariance = self . init_params ( data , means , covariance ) resp = log_prob = prior = None for i in range ( self . n_iter ) : resp , log_prob = self . _e_step ( data , means , covariance ) means , covariance , prior = self . _m_step ( data , resp ) return { 'resp' : resp . view ( shape [ : - 1 ] + ( - 1 , ) ) , 'log_prob' : log_prob . view ( shape [ : - 1 ] + ( - 1 , ) ) , 'means' : means , 'covariance' : covariance , 'prior' : prior }
Does a forward pass of the GMM.
Does a forward pass of the GMM .
"""
        Does a forward pass of the GMM.
        
        Args:
            data (torch.Tensor): Data, shape is (n_batch, ..., n_features)
            means (torch.Tensor): Means, shape (n_batch, n_components, n_features). 
              Defaults to None.
            covariance (torch.Tensor): (n_batch, n_components, n_features, n_features) 
              or (n_batch, n_components, n_features). 
        
        Returns:
            dict: Containing keys 'resp', 'log_prob', 'means', 'covariance', 'prior'.
        """
Containing keys 'resp', 'log_prob', 'means', 'covariance', 'prior'.
Containing keys ' resp ' ' log_prob ' ' means ' ' covariance ' ' prior ' .
dict
self
data
Data, shape is (n_batch, ..., n_features)
Data shape is ( n_batch ... n_features )
means
Means, shape (n_batch, n_components, n_features).
Defaults to None.
Means shape ( n_batch n_components n_features ) . Defaults to None .
covariance
(n_batch, n_components, n_features, n_features)
or (n_batch, n_components, n_features).
( n_batch n_components n_features n_features ) or ( n_batch n_components n_features ) .