Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Accuracy in time #75

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add Accuracy in time #75

wants to merge 1 commit into from

Conversation

Vincent-Maladiere
Copy link
Collaborator

@Vincent-Maladiere Vincent-Maladiere commented Oct 2, 2024

Address #74

Need to document and add test

acc_in_time = []

for tau in taus:
mask_past_censored = (y_test["event"] == 0) & (y_test["duration"] < tau)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to be y_test["duration"] <= tau in Eq 4 of the paper ?

y_pred_at_t = y_pred[:, :, tau_idx]
y_pred_class = y_pred_at_t[~mask_past_censored, :].argmax(axis=1)

y_test_class = y_test["event"] * (y_test["duration"] < tau)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Comment on lines +45 to +46
tau_idx = np.searchsorted(times, tau)
y_pred_at_t = y_pred[:, :, tau_idx]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that okay if tau does not belong to times ? It's probably fine if times is sufficiently fine-grained. Perhaps we could interpolate.

from hazardous.utils import check_y_survival


def accuracy_in_time(y_test, y_pred, times, quantiles=None, taus=None):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the docstring, the math formula as was done for Brier score would be very nice for the API doc (even if it looks kind of aweful in the docstring).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants