Skip to content

Instantly share code, notes, and snippets.

@alonsosilvaallende
Created October 8, 2019 10:17
Show Gist options
  • Save alonsosilvaallende/88122e2e239d2fea7e586c2ac44c9232 to your computer and use it in GitHub Desktop.
Save alonsosilvaallende/88122e2e239d2fea7e586c2ac44c9232 to your computer and use it in GitHub Desktop.
from lifelines.utils import concordance_index
names = ['Alice', 'Bob', 'Carol', 'Dave', 'Eve']
times = [1, 2, 3, 4, 5]
preds = [1, 2, 3, 5, 4]
event_obs = [True, True, False, True, True]
df = pd.DataFrame(data={'Times': times, 'Predictions': preds, 'Event observed?': event_obs}, index=names)
print(df)
print(f'Concordance index: {concordance_index(events, preds, event_obs)}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment