> For the complete documentation index, see [llms.txt](https://www.mlcompendium.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.mlcompendium.com/ai-product/survival-analysis.md).

# Survival Analysis

Time-to-event is its own problem: the question is not whether something happens but when, and some subjects leave the study before it does. The page goes from introductions, to a library, to deep learning methods, and ends with papers and their implementations.

The same notes are in [Life Time Value (LTV)](/ai-product/life-time-value-ltv.md).

The introductions come first. A good [introduction](https://web.archive.org/web/20170712125627/http://www.stat.columbia.edu/~madigan/W2025/notes/survival.pdf) is the archived set of lecture notes. For Survival Analysis the [Intro](https://medium.com/analytics-vidhya/survival-analysis-an-introduction-87a94c98061) by Sushma Dhamodharan explains why the method is needed: logistic regression studies whether risk factors are associated with presence or absence of disease, but when the interest is how a factor affects time to an event, or when subjects drop out and their outcome is unknown, logistic regression is not appropriate. The [brief intro](https://medium.com/geekculture/survival-analysis-a-brief-introduction-e814f88a7a42) by Jia Qing points out that despite the name, survival analysis is not only for survival data and covers a wide area of applications. [Intuition](https://medium.com/data-science/survival-analysis-intuition-implementation-in-python-504fde4fcf8e) is Anurag Pandey's intuition and implementation in Python, framed around the business questions the technique can answer. [What is?](https://medium.com/inside-machine-learning/survival-analysis-cb5832ffcd78) is Kunal Sawarkar's note that a method now behind models of millennials' social media behavior has been around for almost half a millennium.

With the idea in place, the library is [Survival scikit kit](https://scikit-survival.readthedocs.io/en/stable/user_guide/00-introduction.html#What-is-Survival-Analysis?), the introduction to survival analysis with scikit-survival.

Deep learning is the next step. Survival Analysis: Leveraging Deep Learning for Time-to-Event Forecasting comes in two parts, Part [I](https://medium.com/data-science/survival-analysis-predict-time-to-event-with-machine-learning-part-i-ba52f9ab9a46) & [II](https://medium.com/data-science/survival-analysis-leveraging-deep-learning-for-time-to-event-forecasting-5c55bd4bb066); Part II is Lina Faik on survival models for predicting when an event occurs, with use cases such as predictive maintenance, customer churn in marketing analytics, and patient re-hospitalization. The figure below is from that series.

<figure><img src="https://83674056-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mgd48oS5_duTKOVE_Et%2Fuploads%2FjGiTfDDfOOfNZ45xmGtZ%2Fimage.png?alt=media&amp;token=0198f3d0-3abb-42a6-ada0-80f3494bc0da" alt=""><figcaption><p>Survival Analysis: Leveraging Deep Learning for Time-to-Event Forecasting.</p></figcaption></figure>

The papers then compare and implement those methods. [(Paper) A comparison of machine learning methods for survival analysis of high-dimensional clinical data for dementia prediction](https://www.nature.com/articles/s41598-020-77220-w#Sec7) is the Scientific Reports comparison. For DeepSurv, [This repository](https://github.com/czifan/DeepSurv.pytorch) is an unofficial PyTorch implementation of [DeepSurv: Personalized Treatment Recommender System Using A Cox Proportional Hazards Deep Neural Network](https://link.springer.com/article/10.1186/s12874-018-0482-1). We reimplement the experiments in the paper, which is followed by [Github](https://github.com/jaredleekatzman/DeepSurv), and the detailed understanding is available on my [Blog](https://www.cnblogs.com/CZiFan/p/12674144.html). The official repo describes DeepSurv as a deep learning approach to survival analysis, and the blog post explains that survival models relate patient features to treatment outcome, where earlier models such as the linear Cox proportional hazards model needed medical expertise for feature engineering. [DeepSurv Keras](https://github.com/arturomoncadatorres/deepsurvk) is an implementation of DeepSurv using Keras. When several events compete, [DeepHit: A Deep Learning Approach to Survival Analysis with Competing Risks](https://github.com/chl8856/DeepHit) is the code for that model, and [Comparing DeepHit and DeepSurv models on the SUPPORT dataset](https://github.com/ryancburke/DNN_survival/tree/main) puts the two side by side. [Survival analysis with PyTorch](https://github.com/havakv/pycox) is the pycox library that closes the list.

## Deprecated links

{% hint style="warning" %}
These links and images no longer work. The original wording is kept here. A same-resource copy, when one was checked, is used above.
{% endhint %}

* **A good** introduction **for Survival Analysis**. This address no longer opens: <http://www.stat.columbia.edu/\\~madigan/W2025/notes/survival.pdf>
* Intuition. This address no longer opens: <https://towardsdatascience.com/survival-analysis-intuition-implementation-in-python-504fde4fcf8e>
* Survival Analysis: Leveraging Deep Learning for Time-to-Event Forecasting Part I & II. This address no longer opens: <https://towardsdatascience.com/survival-analysis-predict-time-to-event-with-machine-learning-part-i-ba52f9ab9a46>
* Deep Learning for Survival Analysis Authors: Laura Löschmann, Daria Smorodina. This address no longer opens: <https://humboldt-wi.github.io/blog/research/information\\_systems\\_1920/group2\\_survivalanalysis/>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.mlcompendium.com/ai-product/survival-analysis.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
