Survival, Hazard, Regression, Data Science, Hands On Tutorials.
np.random.rand(len(df2)) < 0.8 df2_train = df2[mask] df2_test = df2[~mask] print('Training data set length='+str(len(df2_train))) print('Testing data set length='+str(len(df2_test))) Import the Cox model: from lifelines import CoxPHFitter Create and train the Cox model on the training set: