Skip to content

Commit

Permalink
adding titles to the example
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent-Maladiere committed Jan 15, 2025
1 parent 410474a commit 549900d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions examples/plot_03_competing_risks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
to interpret it.
"""
# %%
# Generating synthetic data
# -------------------------
#
# We begin by generating a linear, synthetic dataset. For each individual, we uniformly
# sample a shape and scale value, which we use to parameterize a Weibull distribution,
# from which we sample a duration.
Expand Down Expand Up @@ -34,6 +37,9 @@
)

# %%
# Training and computing the accuracy in time
# -------------------------------------------
#
# We train a Survival Boost model and compute its accuracy in time.
import numpy as np
from hazardous import SurvivalBoost
Expand Down Expand Up @@ -96,6 +102,9 @@ def predict_aalen_johansen(y_train, time_grid, n_sample_test):
results.append(dict(model_name="Aalan-Johansen", accuracy=accuracy, taus=taus))

# %%
# Results
# -------
#
# We display the accuracy in time to compare Survival Boost with Aalen-Johansen.
# Higher is better. Note that the accuracy is high at very beginning (t < 1000), because
# both models predict that every individual survive.
Expand Down Expand Up @@ -130,6 +139,9 @@ def predict_aalen_johansen(y_train, time_grid, n_sample_test):


# %%
# Understanding the accuracy in time
# ----------------------------------
#
# We can drill into this metric by counting the observed events cumulatively across
# time, and compare that to predictions.
#
Expand Down

0 comments on commit 549900d

Please sign in to comment.