pycox
pycox copied to clipboard
logistichazard and coxph basics
Hi Havard. I wanted to use Logistichazard that is based on Nnet_survival. I couldnt find the architecture of this net. In which file I can understand the architecture? In addition I wanted to ask you what is the difference between cox-ph in your repository and cox-ph in lifelines library of python. First I wanted to use lifelines python package but because I didn't see any codes for images as input I tried to use your amazing repository.
So, the reason we called it a LogisticHazard, rather than Nnet-survival, is that this is a know statistical model for discrete-time survival analysis (so no need to come up with a new name for it). I don't think any of the authors considered a specific network architecture for this. It's essentially just a loss function, and you need to specify your own neural net (which can be an MLP or CNN or whatever). From the Nnet-survival repo they give examples of multiple network architectures.
CoxPH in this repo is also an example of a model without a specific network. If you give it a linear function (single dense layer) you would end up with essentially the same model as in lifelines, but you can also give it a deep net.
On approach very small image datasets is to use a pretrained network to get features (you just get the output in the second-to-last layer or so), and give them to your favorite survival method. In general this is much faster and simpler than training your own thing, so might be worth testing that out anyways
Hi @havakv, is there an intuition behind when to use these two options:
- pretrained network (CNN) to get features + favorite survival method ( extracted features from images and then something like in this example notebook https://nbviewer.org/github/havakv/pycox/blob/master/examples/01_introduction.ipynb )
- CoxPH with pretrained CNN inside (e.g.
model = CoxPH(target_model, optimizer)
)
@zapaishchykova I don't think I'm an authority on this. This is something that is relevant in pretty much every neural net application and really not specific to survival analysis. But my guess would be that using features from a pre-trained model + a survival model would require less data than fine-tuning an CoxPh with a pretrained CNN inside. So maybe that's a rule of thumb?
@havakv that is super insightful Thanks!