Constants
- survivors.constants.RANDOM_STATE = 123
int: Fixed seed for model reproducibility
- survivors.constants.TIME_NAME = 'time'
str: Fixed names for internal representation
- survivors.constants.get_bins(time, cens=None, mode='a', num_bins=100)
Generate array of time points in timeline (from sample)
Parameters
- timearray-like
Time of occurred events.
- censarray-like, optional
Censoring flags. The default is None (all events occurred).
- modestr, optional
Method of generation. The default is ‘a’. ‘a’ : all points (from min to max) ‘q’ : quantile points (quantity is based on num_bins)
- num_binsint, optional
Quantity of required points. The default is 100.
Returns
- binsarray
Timeline
- survivors.constants.get_y(cens, time)
Internal representation of target variable
Parameters
- censarray-like, shape = (n_events,)
Censoring flags.
- timearray-like, shape = (n_events,)
Time of occurred events.
Returns
- ystructured array
Output containing the binary event indicator as first field, and time of event or time of censoring as second field.
- survivors.constants.pd_to_xy(df)
Splitting pandas dataframe to feature space and target variables
Parameters
- dfpandas DataFrame
Must contain columns CENS_NAME and TIME_NAME.
Returns
- Xpandas DataFrame
Feature space with remaining features.
- ystructured array
y containing the binary event indicator as first field, and time of event or time of censoring as second field.