Пример #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
Пример #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
Пример #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
Пример #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
Пример #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