def probListB(tree, data): probDict = {} for arc in tree.iter_descendants(): aList = np.matrix([[0, 0], [0, 0]]) for a in range(0, 1): for X in data: if X(arc.name): ab[1][a] += lh.likelyhoodOfXZ(tree, i, arc, a) * lh.likelyhoodOfX(tree, i) else: ab[0][a] += lh.likelyhoodOfXZ(tree, i, arc, a) * lh.likelyhoodOfX(tree, i) probDict[arc] = aList return probDict
def probListA(tree, data): probDict = {} for arc in tree.iter_descendants(): ab = np.matrix([[0, 0], [0, 0]]) for a in range(0, 1): for b in range(0, 1): for i in data: ab[a][b] += lh.likelyhoodOfXZandZp(tree, i, arc, a, b) * lh.likelyhoodOfX(tree, i) probDict[arc] = ab return probDict