Below is the sample code I got from the documentation website. I want to access the baseline hazards and the coefficients of the variates. '''
from lifelines import CoxPHFitter
from lifelines.datasets import load_rossi
rossi_dataset = load_rossi()
#rossi_dataset.head()
cph = CoxPHFitter()
cph.fit(rossi_dataset, duration_col='week', event_col='arrest',)
cph.print_summary()
'''
From the lifelines docs:
To access the coefficients and the baseline hazard directly, you can use
params_
andbaseline_hazard_
respectively.
from lifelines import CoxPHFitter
from lifelines.datasets import load_rossi
rossi_dataset = load_rossi()
#rossi_dataset.head()
cph = CoxPHFitter()
cph.fit(rossi_dataset, duration_col='week', event_col='arrest',)
print(cph.params_)
print(cph.baseline_survival_)