def p_correct_given_pos(sens, fpr, b):
    """Returns a simple Bayesian probability for the probability
    that a prediction is correct, given that the prediction
    was positive, for the prevailing sensitivity (sens),
    false positive rate (fpr) and base rate of positive 
    examples.
    """
    assert 0 <= sens <= 1, "Sensitivity must be in range [0,1]"
    assert 0 <= fpr <= 1, "FPR must be in range [0,1]"
    return sens * b / (sens * b + fpr * (1 - b))