def estimate_accuracy(T, mutation, p): (test, train) = observe(T, mutation, p) solutions = get_solutions_slow(T, train) size = get_size(T, solutions) total = 0.0 for edge in solutions: imputed = impute(T, edge, train) acc = get_accuracy(test, imputed) prop = coalescent.get_length(T, edge) / size total += acc * prop return total
def get_size(T, edges): size = 0.0 for edge in edges: size += coalescent.get_length(T, edge) return size