havakv / havakv/pycox

Intuitions for padding model output columns?

Open
#152 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
995
Forks
203
PR merge metrics
No merged PRs in 30d

Description

Thanks for creating this wonderful package!

I have a few questions regrading the functions for deephit model:
https://github.com/havakv/pycox/blob/master/pycox/models/deephit.py

**1. Regarding `predit_surv` in line 155**
`surv = 1. - cif.sum(0)`
why it needs to take the sum for `cif`? The cumulative sum has already been calculated in cif, and in my view, it should be:
`surv = 1 - cif`

**2. Regarding `predict_pmf` in line 202**
`pmf = pad_col(preds.view(preds.size(0), -1)).softmax(1)[:, :-1]`
what are the intuitions for padding another column for the model output before softmax?

In the original paper "Continuous and Discrete-Time Survival Prediction with Neural Networks", page 7, it says
`Alternatively, one could let φm+1(x) vary freely, something that is quite common in machine learning, but we chose to follow the typical conventions in statistics.`

I am confused about this trick. If I took the φm+1(x) very large, then the estimated probability (after applying softmax) for each time interval would be very small, will this affect my predictions?

Any comments would be appreciated! Thanks in advance!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with pycox/models/deephit.py at predict_surv around line 155 and predict_pmf around line 202, then compare those operations with page 7 of the cited paper. Trace the shapes and probability calculations to explain the sum and padded column, and document the expected prediction behavior; the issue currently specifies questions rather than a concrete code change.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.