neuroprob/base.py
def _samples(self, covariates, neuron, n_samp, full_cov, trials):
        """
        Evaluates samples from the variational posterior for the rate.
        
        :param bool full_cov: flag if True allows to draw function samples, False allows faster uncertainty
        """
        XZ = self.to_XZ(covariates, trials) # samples, timesteps, dims
        
        with torch.no_grad(): # compute predictive mean and variance
            mean, var = self.compute_F(XZ)
            if isinstance(var, Number): # deterministic mapping
                samples = self.f(mean)
            else:
                mean, var = mean[:, neuron, :], var[:, neuron, :]

                if full_cov:
                    var.view(trials, len(neuron), -1)[:, :, ::var.shape[-1]+1] += self.jitter
                    samples = self.f(distributions.Rn_MVN(mean, covariance_matrix=var)((n_samp,)))
                else:
                    samples = self.f(distributions.Rn_Normal(mean, var.sqrt())((n_samp,)))
            
        return samples

        Evaluates samples from the variational posterior for the rate.
        
        :param bool full_cov: flag if True allows to draw function samples, False allows faster uncertainty
        
Evaluates samples from the variational posterior for the rate.
Evaluates samples from the variational posterior for the rate .
def _samples(self, covariates, neuron, n_samp, full_cov, trials):
        XZ = self.to_XZ(covariates, trials) 
        with torch.no_grad(): 
            mean, var = self.compute_F(XZ)
            if isinstance(var, Number): 
                samples = self.f(mean)
            else:
                mean, var = mean[:, neuron, :], var[:, neuron, :]
                if full_cov:
                    var.view(trials, len(neuron), -1)[:, :, ::var.shape[-1]+1] += self.jitter
                    samples = self.f(distributions.Rn_MVN(mean, covariance_matrix=var)((n_samp,)))
                else:
                    samples = self.f(distributions.Rn_Normal(mean, var.sqrt())((n_samp,)))
        return samples
def _samples ( self , covariates , neuron , n_samp , full_cov , trials ) : XZ = self . to_XZ ( covariates , trials ) with torch . no_grad ( ) : mean , var = self . compute_F ( XZ ) if isinstance ( var , Number ) : samples = self . f ( mean ) else : mean , var = mean [ : , neuron , : ] , var [ : , neuron , : ] if full_cov : var . view ( trials , len ( neuron ) , - 1 ) [ : , : , : : var . shape [ - 1 ] + 1 ] += self . jitter samples = self . f ( distributions . Rn_MVN ( mean , covariance_matrix = var ) ( ( n_samp , ) ) ) else : samples = self . f ( distributions . Rn_Normal ( mean , var . sqrt ( ) ) ( ( n_samp , ) ) ) return samples
Evaluates samples from the variational posterior for the rate.
Evaluates samples from the variational posterior for the rate .
"""
        Evaluates samples from the variational posterior for the rate.
        
        :param bool full_cov: flag if True allows to draw function samples, False allows faster uncertainty
        """ # samples, timesteps, dims # compute predictive mean and variance # deterministic mapping
self
covariates
neuron
n_samp
full_cov
flag if True allows to draw function samples, False allows faster uncertainty
flag if True allows to draw function samples False allows faster uncertainty
trials