def compute_coupling_error(W, i, j, sgn=-1): # constrain coupling term i,j to have a specified sign, # -1 for negative or +1 for positive coupling = compute_coupling(W) log_arg = sgn * coupling[:, i, j] cost = utils.minus_sum_log_ceil(log_arg, big_val / nN) return cost
def compute_isn_error(W): W0x, W0y, W1x, W1y, W2x, W2y, W3x, W3y, s02, k0, k1, k2, k3, kappa, T0, T1, T2, T3, XX, XXp, Eta, Xi, h = parse_W( W) Phi = fprime_m(Eta, compute_var(Xi, s02)) log_arg = Phi[:, 0] * W0y[0, 0] - 1 cost = utils.minus_sum_log_ceil(log_arg, big_val / nN) return cost
def compute_isn_error(W): Wmx,Wmy,Wsx,Wsy,s02,K,kappa,T,XX,XXp,Eta,Xi,h = parse_W(W) 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]*Wmy[0,0]-1 cost = utils.minus_sum_log_ceil(log_arg,big_val/nN) #print('ISN cost: %f'%cost) return cost