neuroprob/likelihoods.py
def sample_helper(self, h, b, neuron, samples):
        """
        NLL helper function for sample evaluation. Note that spikes is batched including history 
        when the model uses history couplings, hence we sample the spike batches without the 
        history segments from this function.
        """
        rates = self.f(h) # watch out for underflow or overflow here
        spikes = self.spikes[b][:, neuron, self.filter_len-1:].to(self.tbin.device)
        if self.trials != 1 and samples > 1 and self.trials < h.shape[0]: # cannot rely on broadcasting
            spikes = spikes.repeat(samples, 1, 1) # MCxtrials
        
        if self.inv_link == 'exp': # spike count times log rate
            l_rates = (spikes*h)
        else:
            l_rates = (spikes*torch.log(rates+1e-12))
            
        return rates, l_rates, spikes

        NLL helper function for sample evaluation. Note that spikes is batched including history 
        when the model uses history couplings, hence we sample the spike batches without the 
        history segments from this function.
        
NLL helper function for sample evaluation. Note that spikes is batched including history
when the model uses history couplings, hence we sample the spike batches without the
history segments from this function.
NLL helper function for sample evaluation . Note that spikes is batched including history when the model uses history couplings hence we sample the spike batches without the history segments from this function .
def sample_helper(self, h, b, neuron, samples):
        rates = self.f(h) 
        spikes = self.spikes[b][:, neuron, self.filter_len-1:].to(self.tbin.device)
        if self.trials != 1 and samples > 1 and self.trials < h.shape[0]: 
            spikes = spikes.repeat(samples, 1, 1) 
        if self.inv_link == 'exp': 
            l_rates = (spikes*h)
        else:
            l_rates = (spikes*torch.log(rates+1e-12))
        return rates, l_rates, spikes
def sample_helper ( self , h , b , neuron , samples ) : rates = self . f ( h ) spikes = self . spikes [ b ] [ : , neuron , self . filter_len - 1 : ] . to ( self . tbin . device ) if self . trials != 1 and samples > 1 and self . trials < h . shape [ 0 ] : spikes = spikes . repeat ( samples , 1 , 1 ) if self . inv_link == 'exp' : l_rates = ( spikes * h ) else : l_rates = ( spikes * torch . log ( rates + 1e-12 ) ) return rates , l_rates , spikes
NLL helper function for sample evaluation.
NLL helper function for sample evaluation .
"""
        NLL helper function for sample evaluation. Note that spikes is batched including history 
        when the model uses history couplings, hence we sample the spike batches without the 
        history segments from this function.
        """ # watch out for underflow or overflow here # cannot rely on broadcasting # MCxtrials # spike count times log rate
self
h
b
neuron
samples