MCPcopy Index your code
hub / github.com/clips/pattern / C

Function C

pattern/metrics.py:692–703  ·  view source on GitHub ↗
(n, k)

Source from the content-addressed store, hash-verified

690 # Binomial coefficient.
691 # n! / k!(n-k)! for 0 <= k <= n
692 def C(n, k):
693 if len(_cache) > 10000:
694 _cache.clear()
695 if k > n - k: # 2x speedup.
696 k = n - k
697 if 0 <= k <= n and (n, k) not in _cache:
698 c = 1.0
699 for i in range(1, int(k + 1)):
700 c *= n - k + i
701 c /= i
702 _cache[(n, k)] = c # 3x speedup.
703 return _cache.get((n, k), 0.0)
704 # Probability of the given data.
705 cutoff = p(a, b, c, d)
706 # Probabilities of "more extreme" data, in both directions (two-tailed).

Callers 1

pFunction · 0.85

Calls 3

lenFunction · 0.85
clearMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected