Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
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
Ejemplo n.º 3
0
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
Ejemplo n.º 4
0
    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
Ejemplo n.º 5
0
    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