I want to train a survival analysis model for predictive maintenance on an asset (confidential, let's say it's a motor). The dataset consists of hourly readings of multiple sensors, the type of motor, motor ID, and whether it failed or not. The dataset is mostly right-censored. As such, we have the following example of a hypothetical dataset:

index | time | motor ID | motor type | vibrations | temperature | failed

0,12-01-2023 09.00, 1, type1, 1531564, 19, 0

0,12-01-2023 10.00, 1, type1, 153, 19, 0

0,12-01-2023 11.00, 1, type1, 19235651, 19, 0 # right censored

0,12-01-2023 9.00, 2, type2, 205654684, 19, 0

0,12-01-2023 10.00, 2, type2, 205654684, 19, 0

0,12-01-2023 11.00, 2, type2, 205654684, 19, 0

0,12-01-2023 12.00, 2, type2, 205654684, 19, 1 # failed

How would you input this time series data into a Survival Analysis model in Python, such as Cox Proportial Hazard Rate or GradientBoostingSurvivalAnalysis? I see some examples around that convert this time series into one row with multiple lag features, but this drastically increases the number of features in the dataset.


1 Answer 1


@rvdinter You could try time-varying survival analysis if you have long formatted data. One package in python that would allow you to do this is Lifelines. If instead your data can be broken up into discrete intervals of time say every hour or some other discrete interval, you could also use discrete-time survival analysis. Recent paper in BMC on this topic. Then you could calculate the hazard for each individual interval and further calculate the cumulative hazard (i.e., cumulative risk) for each individual sensor.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.