Kohone
1/24/2017 - 11:59 AM

рейтинг rating

рейтинг rating

// https://habrahabr.ru/company/darudar/blog/143188/ 

function wilson_score(up, down) {
	if (!up) return -down;
	var n = up + down;
	var z = 1.64485; //1.0 = 85%, 1.6 = 95%
	var phat = up / n;
	return (phat+z*z/(2*n)-z*Math.sqrt((phat*(1-phat)+z*z/(4*n))/n))/(1+z*z/n);
}