Skip to content

Commit

Permalink
Merge pull request #52 from soda-inria/enhance_survival_boost_test
Browse files Browse the repository at this point in the history
Fix TODO in survival_boost_test.py
  • Loading branch information
ogrisel authored Jul 1, 2024
2 parents f245f8a + 52134bd commit fb78d83
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions hazardous/tests/test_survival_boost.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import numpy as np
import pandas as pd
import pytest
from numpy.testing import assert_allclose, assert_array_equal
from numpy.testing import assert_allclose, assert_array_equal, assert_array_less
from sklearn.model_selection import GridSearchCV, train_test_split

from hazardous import SurvivalBoost
Expand Down Expand Up @@ -47,6 +47,7 @@ def test_survival_boost_incidence_and_survival(seed):
any_event_cif_pred = cif_pred[1:].sum(axis=0)
assert_allclose(survival_pred, 1 - any_event_cif_pred)
assert_allclose(survival_pred, cif_pred[0])
assert_allclose(cif_pred.sum(axis=0), 1.0)

ibs_gb_incidence = integrated_brier_score_incidence(
y_train,
Expand All @@ -57,8 +58,14 @@ def test_survival_boost_incidence_and_survival(seed):
)
assert ibs_gb_incidence == pytest.approx(ibs_gb_surv)

# TODO: add assertions for each event CIF
# Check that the survival proba is globally decreasing.
assert_array_less(cif_pred[0, :, -1], cif_pred[0, :, 0])

# Check that the incidence proba are globally increasing.
assert_array_less(
cif_pred[1:, :, 0].sum(axis=0),
cif_pred[1:, :, -1].sum(axis=0),
)
# TODO: add assertion about the .score method


Expand Down

0 comments on commit fb78d83

Please sign in to comment.