This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scipy.stats import beta | |
def binom_interval(success, total, confint=0.95): | |
quantile = (1 - confint) / 2. | |
lower = beta.ppf(quantile, success, total - success + 1) | |
upper = beta.ppf(1 - quantile, success + 1, total - success) | |
return (lower, upper) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import tee, izip | |
from django.contrib.gis.db import models | |
from django.contrib.gis.measure import Distance | |
from geopy.distance import distance as geopy_distance | |
def pairwise(iterable): | |
"s -> (s0,s1), (s1,s2), (s2, s3), ..." | |
a, b = tee(iterable) |