neuroprob/likelihoods.py
def sample(self, rate, neuron=None, XZ=None):
        """
        Sample from the CMP distribution.
        
        :param numpy.array rate: input rate of shape (neuron, timestep)
        :returns: spike train of shape (trials, neuron, timesteps)
        :rtype: np.array
        """
        neuron = self._validate_neuron(neuron)
        mu_ = rate[:, neuron, :]*self.tbin.item()
        
        if self.dispersion_mapping is None:
            nu_ = torch.exp(self.log_nu)[None, :, None].expand(
                rate.shape[0], self.neurons, mu_.shape[-1]).data.cpu().numpy()[:, neuron, :]
        else:
            samples = rate.shape[0]
            disp = self.eval_dispersion_mapping(XZ, samples, neuron)[None, ...].expand(rate.shape[0], 
                                                                                       *mu_.shape[1:])
            nu_ = torch.exp(disp.data).cpu().numpy()
        
        return point_process.gen_CMP(mu_, nu_)

        Sample from the CMP distribution.
        
        :param numpy.array rate: input rate of shape (neuron, timestep)
        :returns: spike train of shape (trials, neuron, timesteps)
        :rtype: np.array
        
Sample from the CMP distribution.
Sample from the CMP distribution .
def sample(self, rate, neuron=None, XZ=None):
        neuron = self._validate_neuron(neuron)
        mu_ = rate[:, neuron, :]*self.tbin.item()
        if self.dispersion_mapping is None:
            nu_ = torch.exp(self.log_nu)[None, :, None].expand(
                rate.shape[0], self.neurons, mu_.shape[-1]).data.cpu().numpy()[:, neuron, :]
        else:
            samples = rate.shape[0]
            disp = self.eval_dispersion_mapping(XZ, samples, neuron)[None, ...].expand(rate.shape[0], 
                                                                                       *mu_.shape[1:])
            nu_ = torch.exp(disp.data).cpu().numpy()
        return point_process.gen_CMP(mu_, nu_)
def sample ( self , rate , neuron = None , XZ = None ) : neuron = self . _validate_neuron ( neuron ) mu_ = rate [ : , neuron , : ] * self . tbin . item ( ) if self . dispersion_mapping is None : nu_ = torch . exp ( self . log_nu ) [ None , : , None ] . expand ( rate . shape [ 0 ] , self . neurons , mu_ . shape [ - 1 ] ) . data . cpu ( ) . numpy ( ) [ : , neuron , : ] else : samples = rate . shape [ 0 ] disp = self . eval_dispersion_mapping ( XZ , samples , neuron ) [ None , ... ] . expand ( rate . shape [ 0 ] , * mu_ . shape [ 1 : ] ) nu_ = torch . exp ( disp . data ) . cpu ( ) . numpy ( ) return point_process . gen_CMP ( mu_ , nu_ )
Sample from the CMP distribution.
Sample from the CMP distribution .
"""
        Sample from the CMP distribution.
        
        :param numpy.array rate: input rate of shape (neuron, timestep)
        :returns: spike train of shape (trials, neuron, timesteps)
        :rtype: np.array
        """
spike train of shape (trials, neuron, timesteps)
spike train of shape ( trials neuron timesteps )
np.array
self
rate
input rate of shape (neuron, timestep)
input rate of shape ( neuron timestep )
neuron
XZ