Пример #1
0
def LQLEP( theta   = Th.dvector()  , M    = Th.dmatrix() ,
           STA     = Th.dvector()  , STC  = Th.dmatrix() , 
           N_spike = Th.dscalar()  , Cm1  = Th.dmatrix() , **other):
    '''
    The actual Linear-Quadratic-Exponential-Poisson log-likelihood, 
    as a function of theta and M, without any barriers or priors.
    '''
#    ImM = Th.identity_like(M)-(M+M.T)/2
    ImM = Cm1-(M+M.T)/2
    ldet = logdet(ImM)
    LQLEP = -0.5 * N_spike *( ldet - logdet(Cm1) \
             - Th.sum(Th.dot(matrix_inverse(ImM),theta) * theta) \
             + 2. * Th.sum( theta * STA ) \
             + Th.sum( M * (STC + Th.outer(STA,STA)) ))
    other.update(locals())
    return named( **other )
Пример #2
0
def LNLEP( theta = Th.dvector('theta'), M    = Th.dmatrix('M') ,
                       STA   = Th.dvector('STA')  , STC  = Th.dmatrix('STC'), 
                       N_spike = Th.dscalar('N_spike'), **other):
    '''
    The actual quadratic-Poisson model, as a function of theta and M, 
    without any barriers or priors.
    '''
    ImM = Th.identity_like(M)-(M+M.T)/2
    ldet = logdet(ImM) # Th.log( det( ImM) )  # logdet(ImM)
    return -0.5 * N_spike *( 
             ldet \
             - Th.sum(Th.dot(matrix_inverse(ImM),theta) * theta) \
             + 2. * Th.sum( theta * STA ) \
             + Th.sum( M * (STC + Th.outer(STA,STA)) ))
Пример #3
0
def quadratic_Poisson( theta = Th.dvector('theta'), M    = Th.dmatrix('M') ,
                       STA   = Th.dvector('STA')  , STC  = Th.dmatrix('STC'), 
                       N_spike = Th.dscalar('N_spike'), logprior = 0 , 
                       **other):
    '''
    The actual quadratic-Poisson model, as a function of theta and M, 
    with a barrier on the log-det term and a prior.
    '''
    ImM = Th.identity_like(M)-(M+M.T)/2
    ldet = logdet(ImM)    # Th.log( det( ImM) )  # logdet(ImM)
    return -0.5 * N_spike *(
             ldet + logprior \
             - 1./(ldet+250.)**2. \
             - Th.sum(Th.dot(matrix_inverse(ImM),theta) * theta) \
             + 2. * Th.sum( theta * STA ) \
             + Th.sum( M * (STC + Th.outer(STA,STA)) ))
Пример #4
0
def logdetIM( M     = Th.dmatrix('M') , **result):
    return logdet( Th.identity_like(M)-(M+M.T)/2 )