Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from lifelines.utils import concordance_index | |
names = ['Alice', 'Bob', 'Carol', 'Dave', 'Eve'] | |
events = [1, 2, 3, 4, 5] | |
preds = [1, 2, 3, 4, 5] | |
df = pd.DataFrame(data={'Churn times': events, 'Predictions': preds}, index=names) | |
print(df) | |
print(f'Concordance index: {concordance_index(events, preds)}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from lifelines.utils import concordance_index | |
names = ['Alice', 'Bob', 'Carol', 'Dave', 'Eve'] | |
events = [1, 2, 3, 4, 5] | |
preds = [2, 3, 5, 8, 14] | |
df = pd.DataFrame(data={'Churn times': events, 'Predictions': preds}, index=names) | |
print(df) | |
print(f'Concordance index: {concordance_index(events, preds)}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from lifelines.utils import concordance_index | |
names = ['Alice', 'Bob', 'Carol', 'Dave', 'Eve'] | |
events = [1, 2, 3, 4, 5] | |
preds = np.log(events) | |
df = pd.DataFrame(data={'Churn times': events, 'Predictions': preds}, index=names) | |
print(df) | |
print(f'Concordance index: {concordance_index(events, preds)}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from lifelines.utils import concordance_index | |
names = ['Alice', 'Bob', 'Carol', 'Dave', 'Eve'] | |
events = [1, 2, 3, 4, 5] | |
preds = [1/event for event in events] | |
df = pd.DataFrame(data={'Churn dates': events, 'Predictions': preds}, index=names) | |
print(df) | |
print(f'Concordance index: {concordance_index(events, preds)}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!pip install lifelines |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from lifelines.utils import concordance_index | |
names = ['Alice', 'Bob', 'Carol', 'Dave', 'Eve'] | |
events = [1, 2, 3, 4, 5] | |
preds = [3, 2, 1, 5, 4] | |
df = pd.DataFrame(data={'Churn times': events, 'Predictions': preds}, index=names) | |
print(df) | |
print(f'Concordance index: {concordance_index(events, preds)}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from lifelines.utils import concordance_index | |
names = ['Alice', 'Bob', 'Carol', 'Dave', 'Eve'] | |
events = [1, 2, 3, 4, 5] | |
preds = [1, 2, 3, 4, 4] | |
df = pd.DataFrame(data={'Churn times': events, 'Predictions': preds}, index=names) | |
print(df) | |
print(f'Concordance index: {concordance_index(events, preds)}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)}') |
OlderNewer