Skip to content

Instantly share code, notes, and snippets.

@mhnatiuk
mhnatiuk / score_binomial_rating.py
Last active August 29, 2015 14:24
Calculate lower bound of Wilson score confidence interval for a Bernoulli parameter
import math
import scipy.stats as stats
"""
Algorithms desgin:
http://www.evanmiller.org/how-not-to-sort-by-average-rating.html
What: Calculate lower bound of Wilson score confidence interval for a Bernoulli parameter
Why: Sort data by binomial votes score
"""
def ci_lower_bound(pos, n, confidence):
# -*- coding: utf-8 -*-
"""
Python decorator to measure average execution time of a function.
Modification of Andreas Jung' function
https://www.andreas-jung.com/contents/a-python-decorator-for-measuring-the-execution-time-of-methods
@author Mikołaj Hnatiuk
@www www.mikolajhnatiuk.com
"""