survivalpredict.pipeline.build_sklearn_pipeline_target¶
- survivalpredict.pipeline.build_sklearn_pipeline_target(times, events, strata=None, times_start=None)¶
Target builder for survivalpredict’s ‘SklearnSurvivalPipeline’.
Takes ‘times’, ‘events’ arrays, and optionally ‘strata’ and ‘times_start’ inputs; and builds a singular numpy array that can function as the ‘y’/observed for ‘SklearnSurvivalPipeline’ and scikit-learn’s api.
- Parameters:
times (array-like of shape (n_samples), dtype=np.int64) – Point in time last observed.
events (array-like of shape (n_samples), dtype=np.bool_) – Experianed event.
strata (array-like of shape (n_samples,), dtype=np.int64, default=None) – If passed in, associated strata for per observation.
times_start (array-like of shape (n_samples, dtype=np.int64), default=None) – Starting point for observation. If not passed in, all times_start times are assumed to be 0.
- Returns:
Returns a numpy array that survivalpredict knows how to unpack, while allowing said numpy array to flow through the various machinery of scikit-learn.
- Return type:
ndarray