def test_ibs_nottingham_1(nottingham_prognostic_index):
    times = numpy.linspace(365, 1825, 5)  # t=1..5 years
    preds, y = nottingham_prognostic_index(times)

    score = integrated_brier_score(y, y, preds, times=times)
    assert round(abs(score - 0.197936392255733), 6) == 0

    score = integrated_brier_score(y, y, preds[:, :4], times=times[:4])
    assert round(abs(score - 0.185922397142833), 6) == 0
def test_ibs_nottingham_2(nottingham_prognostic_index):
    times = numpy.arange(1095, 1826)  # t=3..5 years
    preds, y = nottingham_prognostic_index(times)

    score = integrated_brier_score(y, y, preds, times=times)

    assert round(abs(score - 0.231553687189643), 6) == 0
def test_ibs_single_time_point(nottingham_prognostic_index):
    pred, y = nottingham_prognostic_index([1825])

    with pytest.raises(ValueError,
                       match="At least two time points must be given"):
        integrated_brier_score(y, y, pred, times=1825)