Skip to content

xgbse.converters.convert_to_structured

Converts data in time (T) and event (E) format to a structured numpy array. Provides common interface to other libraries such as sksurv and sklearn.

Parameters:

Name Type Description Default
T np.array

Array of times

required
E np.array

Array of events

required

Returns:

Type Description
np.array

Structured array containing the boolean event indicator as first field, and time of event or time of censoring as second field

xgbse.converters.convert_y

Convert structured array y into an array of event indicators (E) and time of events (T).

Parameters:

Name Type Description Default
y structured array(numpy.bool_, numpy.number

Binary event indicator as first field, and time of event or time of censoring as second field.

required

Returns:

Type Description
T ([np.array, pd.Series])

Time of events E ([np.array, pd.Series]): Binary event indicator