def forward_LQLEP( stimulus, all_spikes, model, indices, vardict=u2c_parameterization()): print print 'Preparing forward LQLEP model.' sys.stdout.flush() vardict = Poisson_LL( **RGC_LE( **subunit_LQ( **vardict))) variables = ['stimulus','all_spikes','u','V2','sv1','T','c','uc'] knowns = model knowns.update({'T':retina.place_cells( cones, cones, shapes )}) unknowns = {'stimulus':stimulus, 'all_spikes':all_spikes} outputs = {'LL': vardict['loglikelihood'], 'rates': vardict['rgc_out']} # 'theta': vardict['theta']} NRGC = len( all_spikes ) return make_global_objective(unknowns,knowns,vardict,variables,outputs,indices,NRGC)
def global_objective( unknowns, knowns, vardict, run, indices ): print print 'Preparing objective for unknowns: ', [(n,v.shape) for n,v in unknowns.items()] sys.stdout.flush() variables = ['u','V2','sv1','sparse_STA','sparse_STC','V1','N_spikes','T','cov'] run.update({'u':init_u, 'V2':init_V2, 'sv1':init_sv1(run['rgc_type']), 'T':retina.place_cells( cones, cones, shapes )}) default( knowns, run, variables ) outputs = {} update_dict( outputs, 'f', vardict , ['LNP', 'LQLEP_wPrior', 'LQLEP_positiveV1', 'LQLEP_positive_u'] ) update_dict( outputs , 'LL' , vardict , ['LNP', 'LQLEP'] ) update_dict( outputs , 'barrier' , vardict , ['barrier','barrier_positiveV1','barrier_positive_u'] ) update_dict( outputs , 'nonlinearity', vardict , ['nonlinearity'] ) if unknowns.has_key('sv1'): print print 'sv1 shape', unknowns['sv1'].shape print NRGC = len( run['sparse_STA'] ) return make_global_objective(unknowns,knowns,vardict,variables,outputs,indices,NRGC)