# -*- coding: utf-8 -*-
import numpy as np
def bayesian_smoothing(c, i):
r = 1.0*c/i
# print r
m = np.mean(r)
v = np.var(r)
a = (m*(1-m)/v-1)*m
b = (m*(1-m)/v-1)*(1-m)
c = c+a
i = i+a+b
return 1.0*c/i
c = np.array([1,2,3])
i = np.array([4,5,6])
print bayesian_smoothing(c, i)