bayesian_smoothing贝叶斯平滑
作者:互联网
# -*- 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)
标签:1.0,print,贝叶斯,np,bayesian,array,smoothing 来源: https://www.cnblogs.com/kayy/p/11272269.html