Did I find the right examples for you? yes no

All Samples(2)  |  Call(2)  |  Derive(0)  |  Import(0)
Returns the harmonic mean. Will crash if any value is zero.

        def harmonic_mean(lst):
    "Returns the harmonic mean. Will crash if any value is zero."
    n = len(lst)
    inv_sum = sum((1.0 / x) for x in lst)
    return (1.0 / ((1.0 / n) * inv_sum))
        


src/p/y/pypred-0.3.6/pypred/contains.py   pypred(Download)
    for idx, s in enumerate(sets):
        freqs = [counts[i]/total for i in s]
        hm = util.harmonic_mean(freqs)
        scores.append((hm, exprs[idx]))
 

src/p/y/pypred-HEAD/pypred/contains.py   pypred(Download)
    for idx, s in enumerate(sets):
        freqs = [counts[i]/total for i in s]
        hm = util.harmonic_mean(freqs)
        scores.append((hm, exprs[idx]))