jaredleekatzman / DeepSurv

DeepSurv is a deep learning approach to survival analysis.
MIT License
566 stars 166 forks source link

partial log likelihood implementation #71

Open arjunascagnetto opened 3 years ago

arjunascagnetto commented 3 years ago

Hi all,

thanks for your interesting and very usefull work.

we have read your interesting paper "DeepSurv: Personalized Treatment Recommender System Using A Cox Proportional Hazards Deep Neural Network." . We are very interested in implementing your deep learning approach to survival analysis. Therefore we looked into your code on github and we have a question about the partial log likelihood implementation. In particular we don't understand where you are selecting the appropriate risk set depending on the specific event times when you apply the function T.extr_ops.cumsum() . In other words with respect to the following formula

\frac{1}{ND} \sum{i \in D}[F(xi,\theta) - log(\sum{j \in R_i} e^F(x_j,\theta))] - \lambda P(\theta)

where do you take into account the R_i in the code (loglikelihood calculation) ?

    risk = self.risk(deterministic)
    hazard_ratio = T.exp(risk)
    log_risk = T.log(T.extra_ops.cumsum(hazard_ratio))  <------ HERE
    uncensored_likelihood = risk.T - log_risk
    censored_likelihood = uncensored_likelihood * E

thanks, arjuna