def globallossfunction(tr, sub): threshold = 10 loss = np.zeros((len(tr), len(sub))) distance = np.zeros((len(tr), len(sub))) for jj in range(len(tr)): for ii in range(len(sub)): loss[jj, ii], distance[jj, ii] = lossfunction(tr[jj], sub[ii]) #loss[jj, ii], distance[jj, ii] = lossfunction__old1(tr[jj], sub[ii]) print loss return loss, distance, threshold
def globallossfunction(tr, sub): threshold = 80 loss = np.zeros((len(tr), len(sub))) for jj in range(len(tr)): for ii in range(len(sub)): loss[jj, ii] = lossfunction(tr[jj], sub[ii]) return loss, threshold
def resample(self): if np.sum(self.prob) > 0: p = self.p y, x = p.shape new_p = np.zeros((y, x)) for ii in range(len(self.p)): idx = self.pmfrnd() new_p[ii, :] = p[idx, :] self.p = new_p