Esempio n. 1
0
def vpdist_toset_ps(st, lot, q):
    n = len(st)
    if n == 0:
        return np.ones(len(lot))
    d = np.ones(len(lot), np.float64)
    q2 = 2.0 / q
    for i, e in enumerate(lot):
        m = len(e)
        if m:
            d[i] = et.vpdist(st, e, q2) / (n + m)
    return d
Esempio n. 2
0
def vpdist_ps(lot, q):
    q2 = 2.0 / q
    nl = len(lot)
    dm = np.zeros((nl, nl))
    for i in range(nl - 1):
        for j in range(i, nl):
            n = len(lot[i])
            m = len(lot[j])
            if not n or not m:
                d = 1
            else:
                d = et.vpdist(lot[i], lot[j], q2) / (n + m)
            dm[i, j] = d
            dm[j, i] = d
    return dm
Esempio n. 3
0
def vpdist_pe(lot, q):
    exp = {'nprob': float(len([x for x in lot if not x])) / len(lot)}

    q2 = 2.0 / q
    nl = len(lot)
    dm = np.zeros((nl, nl))
    for i in range(nl - 1):
        for j in range(i, nl):
            n = len(lot[i])
            m = len(lot[j])
            if not n or not m:
                d = 1
            else:
                d = et.vpdist(lot[i], lot[j], q2) / (n + m)
            dm[i, j] = d
            dm[j, i] = d
    return dm
Esempio n. 4
0
def vdC(st1, st2, q):
    '''
    Should return the same thing as vpP, but much faster. Calls et.vpdist(st1, st2, 2.0/q)
    '''
    return et.vpdist(st1, st2, 2.0 / q)