def discrepancy( self, ystar, y ): J = len(y) d = y - ystar if self.direction == self.up: d *= -1 N = 1 # assume every observation is outside of tube disc = np.zeros( J ) for j in range(J): h = heavyside( d[j] ) if h > 0.5: disc[j] = d[j] return disc
def discrepancy(self, ystar, y): J = len(y) d = y - ystar if self.direction == self.up: d *= -1 N = 1 # assume every observation is outside of tube disc = np.zeros(J) for j in range(J): h = heavyside(d[j]) if h > 0.5: disc[j] = d[j] return disc
def loglikelihood( self, observation_statistics, pseudo_statistics ): # sh = observation_statistics.shape # if len(sh) > 1: # N,J = sh # elif len(sh) == 0: # N=1 # J=1 # else: # N = sh[0] # J = 1 # # psh = pseudo_statistics.shape # if len(psh) > 1: # S,J = psh # else: # S = psh[0] # J = 1 # # # if S>1: # # pdb.set_trace() # if N > 1: # assert S == 1,"only allow one greater than the other" # elif S > 1: # N=S # start with the difference d = y - y_star J = len(pseudo_statistics) d = pseudo_statistics - observation_statistics if self.direction == self.up: d *= -1 N = 1 # assume every observation is outside of tube loglikelihood = np.zeros( J ) for j in range(J): h = heavyside( d[j] ) if h > 0.5: loglikelihood[j] = -d[j]/self.epsilon[j] if self.cliff_at is not None: if pseudo_statistics[j] == self.cliff_at[j]: loglikelihood[j] = -np.inf #pdb.set_trace() return np.sum(loglikelihood)
def loglikelihood(self, observation_statistics, pseudo_statistics): # sh = observation_statistics.shape # if len(sh) > 1: # N,J = sh # elif len(sh) == 0: # N=1 # J=1 # else: # N = sh[0] # J = 1 # # psh = pseudo_statistics.shape # if len(psh) > 1: # S,J = psh # else: # S = psh[0] # J = 1 # # # if S>1: # # pdb.set_trace() # if N > 1: # assert S == 1,"only allow one greater than the other" # elif S > 1: # N=S # start with the difference d = y - y_star J = len(pseudo_statistics) d = pseudo_statistics - observation_statistics if self.direction == self.up: d *= -1 N = 1 # assume every observation is outside of tube loglikelihood = np.zeros(J) for j in range(J): h = heavyside(d[j]) if h > 0.5: loglikelihood[j] = -0.5 * pow(d[j] / self.epsilon[j], 2) if self.cliff_at is not None: if pseudo_statistics[j] == self.cliff_at[j]: loglikelihood[j] = -np.inf #pdb.set_trace() return np.sum(loglikelihood)
def loglikelihood_kernel( self, observation_statistics, pseudo_statistics ): # start with the difference d = y - y_star J = len(pseudo_statistics) d = pseudo_statistics - observation_statistics if self.direction == self.up: d *= -1 N = 1 # assume every observation is outside of tube loglikelihood = np.zeros( J ) for j in range(J): h = heavyside( d[j] ) if h > 0.5: loglikelihood[j] = -d[j]/self.epsilon[j] if self.cliff_at is not None: if pseudo_statistics[j] == self.cliff_at[j]: loglikelihood[j] = -np.inf #pdb.set_trace() return np.sum(loglikelihood)
def loglikelihood_kernel(self, observation_statistics, pseudo_statistics): # start with the difference d = y - y_star J = len(pseudo_statistics) d = pseudo_statistics - observation_statistics if self.direction == self.up: d *= -1 N = 1 # assume every observation is outside of tube loglikelihood = np.zeros(J) for j in range(J): h = heavyside(d[j]) if h > 0.5: loglikelihood[j] = -0.5 * pow(d[j] / self.epsilon[j], 2) if self.cliff_at is not None: if pseudo_statistics[j] == self.cliff_at[j]: loglikelihood[j] = -np.inf #pdb.set_trace() return np.sum(loglikelihood)