An approximation to the metric used in the Kellogg et al. paper: "The fraction correct is defined as the number of mutations categorized correctly divided by the total number of mutations in the benchmark set."

def fraction_correct_values(indices, x_values, y_values, x_cutoff = 1.0, y_cutoff = 1.0, ignore_null_values = False):
    '''
    An approximation to the metric used in the Kellogg et al. paper: "The fraction correct is defined as the number of mutations categorized correctly divided by the total number of mutations in the benchmark set."
    '''
    num_points = len(indices)
    assert(num_points == len(x_values) == len(y_values))
    correct = []
    for i in range(num_points):
        index = indices[i]
        x = x_values[i]
        y = y_values[i]
        if (x == None or y == None or numpy.isnan(x) or numpy.isnan(y)) and ignore_null_values: # If we are missing values then we either discount the case or consider it as incorrect depending on ignore_null_values
            correct.append(numpy.nan)
        elif (x >= x_cutoff) and (y >= y_cutoff): # both positive
            correct.append(1.0)
        elif (x <= -x_cutoff) and (y <= -y_cutoff): # both negative
            correct.append(1.0)
        elif (-x_cutoff < x < x_cutoff) and (-y_cutoff < y < y_cutoff): # both neutral
            correct.append(1.0)
        else:
            correct.append(0.0)
    return correct