예제 #1
0
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
예제 #2
0
def get_size(T, edges):
  size = 0.0
  for edge in edges:
    size += coalescent.get_length(T, edge)

  return size