Usage
The following examples show how the step can be used in a recipe.Examples
Examples
- Example 1
- Example 2
- Signature
Train a Cox Proportional Hazard survival model
Inputs & Outputs
The following are the inputs expected by the step and the outputs it produces. These are generally columns (ds.first_name), datasets (ds or ds[["first_name", "last_name"]]) or models (referenced
by name e.g. "churn-clf").
Inputs
Inputs
dataset
required
Should contain the target columns (see
target parameter below) and the feature columns you wish to use in the model.Outputs
Outputs
Configuration
The following parameters can be used to configure the behaviour of the step by including them in a json object as the last “input” to the step, i.e.step(..., {"param": "value", ...}) -> (output).
Parameters
Parameters
- CoxPH
string
default:"CoxPH"
Kind of survival model to train.
“CoxPH” trains a lifelines Cox Proportional Hazard model.
array
object
Configure the kind of predictions to return.
Properties
Properties
string
default:"median"
Kind of prediction.
median returns the median survival time. percentile returns the survival time at
the given percentile. expectation returns the expected survival time.
survival_function returns the whole survival function (one series per sample).Values must be one of the following:medianpercentileexpectationsurvival_function
number
default:"0.5"
Percentile when
kind is set to percentileValues must be in the following range:[array, object]
Points in time to predict.
Configures at which points to predict when
kind is set to survival_function.
Either an explicit array of durations, or an object specifying a duration step size and
maximum duration.object
Model parameters.
Properties
Properties
number
default:"0.05"
Level in the confidence intervals.
number
default:"0.0"
Penalizer strength.
Attach an L2 penalizer to the size of the coefficients during regression.
This improves stability of the estimates and controls for high correlation between covariates.Values must be in the following range:
number
default:"0.0"
L1 vs L2 penalty ratio.
Specify what ratio to assign to a L1 vs L2 penalty (ridge vs lasso). Same as scikit-learn
convention.Values must be in the following range:
array[string]
Columns to use in stratification.
This is useful if a categorical covariate does not obey the proportional hazard assumption.
Array items
Array items
string (ds.column:categorical)
Each item in array.
string
default:"breslow"
How the fitter should estimate the baseline.Values must be one of the following:
breslowsplinepiecewise