def compute_log_p_sample(data, f, t):
C = len(data.cn)
population_prior = np.zeros(3)
population_prior[0] = (1 - t)
population_prior[1] = t * (1 - f)
population_prior[2] = t * f
ll = np.ones(C, dtype=np.float64) * np.inf * -1
for c in range(C):
e_vaf = 0
norm_const = 0
for i in range(3):
e_cn = population_prior[i] * data.cn[c, i]
e_vaf += e_cn * data.mu[c, i]
norm_const += e_cn
e_vaf /= norm_const
ll[c] = data.log_pi[c] + binomial_log_pdf(data.a + data.b, data.b, e_vaf)
return log_sum_exp(ll)
评论列表
文章目录