Skip to content

Instantly share code, notes, and snippets.

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