def compute_smi_error(fval,fval12,halo_mult=1,chrimson_mult=1):
     fval = compute_f_(Eta,Xi,s02)
     ipc = 0
     def compute_dsmi(fval):
         fpc = fval[:,ipc].reshape(topo_shape)
         smi = fpc[-1,:]/np.max(fpc,0)
         dsmi = smi[1] - smi[5]
         return dsmi
     dsmis = [compute_dsmi(f) for f in [fval,fval12[:nN],fval12[nN:]]]
     smi_halo_error = halo_mult*(dsmis[1] - dsmis[0])**2
     smi_chrimson_error = chrimson_mult*utils.minus_sum_log_slope(dsmis[2] - dsmis[0],big_val)
     smi_baseline_error = 1*utils.minus_sum_log_slope(dsmis[0],big_val)
     return smi_halo_error,smi_chrimson_error,smi_baseline_error
 def compute_coupling_error(W1,W2,i,j,sgn=-1):
     # constrain coupling term i,j to have a specified sign, 
     # -1 for negative or +1 for positive
     coupling = compute_coupling(W1,W2)
     log_arg = sgn*coupling[:,i,j]
     cost = utils.minus_sum_log_slope(log_arg,big_val/nN)
     return cost
Exemplo n.º 3
0
 def compute_isn_error(W1,W2):
     #Wmx,Wmy,Wsx,Wsy,s02,Kin,Kout,kappa,Tin,Tout,XX,XXp,Eta,Xi,h1,h2 = parse_W(W)
     W0x,W0y,W1x,W1y,W2x,W2y,W3x,W3y,s02,Kin0,Kin1,Kxout0,Kyout0,Kxout1,Kyout1,kappa,Tin0,Tin1,Txout0,Tyout0,Txout1,Tyout1,h1,h2,bl,amp = parse_W1(W1)
     XX,XXp,Eta,Xi = parse_W2(W2)
     Phi = fprime_m(Eta,compute_var(Xi,s02))
     #print('min Eta: %f'%np.min(Eta[:,0]))
     #print('WEE: %f'%Wmy[0,0])
     #print('min phiE*WEE: %f'%np.min(Phi[:,0]*Wmy[0,0]))
     log_arg = Phi[:,0]*W0y[0,0]-1
     cost = utils.minus_sum_log_slope(log_arg,big_val/nN)
     #print('ISN cost: %f'%cost)
     return cost
 def compute_isn_error(W1,W2):
     #Wmx,Wmy,Wsx,Wsy,s02,K,kappa,T,XX,XXp,Eta,Xi,h1,h2 = parse_W(W)
     Wmx,Wmy,Wsx,Wsy,s02,K,kappa,T,h1,h2,bl,amp = parse_W1(W1)
     XX,XXp,Eta,Xi = parse_W2(W2)
     Phi = fprime_m(Eta,compute_var(Xi,s02))
     #print('min Eta: %f'%np.min(Eta[:,0]))
     #print('WEE: %f'%Wmy[0,0])
     #print('min phiE*WEE: %f'%np.min(Phi[:,0]*Wmy[0,0]))
     if K.size:
         k = K[0]
     else:
         k = 0
     if T.size:
         t = T[0]
     else:
         t = 0
     log_arg = Phi[:,0]*Wmy[0,0]*(1+k)*(1+t) - 1
     cost = utils.minus_sum_log_slope(log_arg,big_val/nN)
     #print('ISN cost: %f'%cost)
     return cost