scripts/model_utils.py
def compute_pred_P(full_model, batch, use_neuron, ts, cov_samples=10, ll_samples=1, tr=0):
    """
    Predictive posterior computed from model.
    """
    _, h, _ = full_model.evaluate(batch, obs_neuron=None, cov_samples=cov_samples, 
                                   ll_samples=ll_samples, ll_mode='MC', lv_input=None)

    with torch.no_grad():
        F_dims = full_model.likelihood._neuron_to_F(use_neuron)
        H = h[:, tr, F_dims, :]
        if ts is None:
            ts = np.arange(H.shape[-1])
        H = H[..., ts]
        logp = full_model.likelihood.get_logp(H, use_neuron) # samples, N, time, K
    P_mc = torch.exp(logp)
    return P_mc

    Predictive posterior computed from model.
    
Predictive posterior computed from model.
Predictive posterior computed from model .
def compute_pred_P(full_model, batch, use_neuron, ts, cov_samples=10, ll_samples=1, tr=0):
    _, h, _ = full_model.evaluate(batch, obs_neuron=None, cov_samples=cov_samples, 
                                   ll_samples=ll_samples, ll_mode='MC', lv_input=None)
    with torch.no_grad():
        F_dims = full_model.likelihood._neuron_to_F(use_neuron)
        H = h[:, tr, F_dims, :]
        if ts is None:
            ts = np.arange(H.shape[-1])
        H = H[..., ts]
        logp = full_model.likelihood.get_logp(H, use_neuron) 
    P_mc = torch.exp(logp)
    return P_mc
def compute_pred_P ( full_model , batch , use_neuron , ts , cov_samples = 10 , ll_samples = 1 , tr = 0 ) : _ , h , _ = full_model . evaluate ( batch , obs_neuron = None , cov_samples = cov_samples , ll_samples = ll_samples , ll_mode = 'MC' , lv_input = None ) with torch . no_grad ( ) : F_dims = full_model . likelihood . _neuron_to_F ( use_neuron ) H = h [ : , tr , F_dims , : ] if ts is None : ts = np . arange ( H . shape [ - 1 ] ) H = H [ ... , ts ] logp = full_model . likelihood . get_logp ( H , use_neuron ) P_mc = torch . exp ( logp ) return P_mc
Predictive posterior computed from model.
Predictive posterior computed from model .
"""
    Predictive posterior computed from model.
    """ # samples, N, time, K
full_model
batch
use_neuron
ts
cov_samples
ll_samples
tr