This repository allows to reproduce the results in Neural Survival Clustering: Non parametric mixture of neural networks for survival clustering This paper approaches survival analysis as a mixture of neural baselines whereby different baseline cumulative hazard functions are modelled using positive and monotone neural networks.
The model consists in a mixture of K neural networks that model different population-level survival distributions, and an assignment neural network that weights these different mixtures given the input data.
To use the model, one needs to execute:
from nsc import NeuralSurvivalClustering
model = NeuralSurvivalClustering()
model.fit(x, t, e) # Fit the model on covariates x, with event time t, and event indicator e (e = 1 means event)
model.predict_survival(x, horizon) # Predict the survival for covariates x at a given horizon To then explore the clustering structre:
model.predict_alphas(x) # Obtain the soft assignemnt to the different cluster
model.survival_cluster(horizons) # Compute the survival of the different clusters at different horizonsA full example with analysis is provided in examples/Neural Survival Clustering on SUPPORT Dataset.ipynb.
To reproduce the paper's results:
- Clone the repository with dependencies:
git clone [email protected]:Jeanselme/NeuralSurvivalClustering.git --recursive - Create a conda environment with all necessary libraries
pycox,lifelines,pysurvival. - Add path
export PYTHONPATH="$PWD:$PWD/DeepSurvivalMachines:$PWD/SuMo-net:$PYTHONPATH" - Run
examples/experiments_paper.py METABRIC - Repeat with
SUPPORTandSYNTHETIC - Analysis using
examples/Analysis.ipynb
Adding a new method consists in adding a child to Experiment in experiment.py with functions to compute the nll and fit the model.
Then, add the method in examples/experiments_paper.py and follow the previous point.
TODOs have been added to make the addition of a new method easier.
- Competing risks.
- Post analysis: Replacing assignment neural network by more interpretable approach.
We followed the same structure than the DeepSurvivalMachines repository with the model in nsc/ - only the api should be used to test the model. Examples are provided in examples/.
git clone [email protected]:Jeanselme/NeuralSurvivalClustering.git --recursive
The model relies on DeepSurvivalMachines, SuMo-net, pytorch, numpy and tqdm.
To run the set of experiments pycox, lifelines, pysurvival are necessary.
