X = orth(X) return np.dot(X,np.dot(uu,X)) data = {} init_params = {} #init_params = 0.1*( ones(len(UU)) + 2.*R.randn(len(UU)) ) #init_params = UU iii = 1 data = [{ 'STA':STA[i] , 'STC':STC[i] } for i in range(iii)] init_params = [{'theta':STA[i] * 0.05 , 'M':STC[iii] * 0.05} for i in range(iii)] term = kolia_theano.term(init_params=init_params[0],differentiate=['f'], f=quadratic_Poisson, barrier=barrier, ldet=ldet, eigs=eigs) terms = [deepcopy(term) for i in range(iii)] def syM(x): xx = x['M'] x['M'] = (xx+np.transpose(xx))/2. return x def symm(X): X = [ syM(x) for x in objective.inflate(X)] return objective.flatten(X) def callback_one(ip,d): pp = objective.inflate(ip) print
quad = lambda x : 0.2*(x+1.)**2 (N_spikes,STA,STC), U, V1, bbar, Cb , STAB = LNLNP(T=10000,sigma=sigma,NL=quad,N=27) Nsub, N = U.shape NRGC, Nsub = V1.shape iii = NRGC data = [{ 'STA':STA[i] , \ 'STC':STC[i] } for i in range(iii)] init_params = [{'theta':data[i]['STA'] * 0.1 , \ 'M':data[i]['STC'] * 0.1} for i in range(iii)] term = kolia_theano.term(init_params=init_params[0],differentiate=['f'], f=quadratic_Poisson, barrier=eig_barrier) class Objective: pass objective = Objective() def f(params,args): return np.sum([term.f(params[i*N*(N+1):(i+1)*N*(N+1)],args[i]) for i in range(iii)],0) def barrier(params,args): return np.sum([term.barrier(params[i*N*(N+1):(i+1)*N*(N+1)],args[i]) for i in range(iii)],0) def df(params,args): return np.concatenate([term.df(params[i*N*(N+1):(i+1)*N*(N+1)],args[i]) for i in range(iii)]) objective.f = f objective.df = df