MCPcopy Create free account
hub / github.com/AIRMEC/HECTOR / forward_survival

Method forward_survival

model.py:279–286  ·  view source on GitHub ↗
(self, logits)

Source from the content-addressed store, hash-verified

277 #raise Exception ...
278
279 def forward_survival(self, logits):
280 Y_hat = torch.topk(logits, 1, dim=1)[1]
281 # Model outputs the hazards with sigmoid activation function.
282 hazards = torch.sigmoid(logits) #size [1, n_classes] h(t|X) := P(T=t|T>=t,X)
283 #S(t|X) := P(T>=t|X) = TT (1-h(s|X)) for s=1,t. This is computed for each discrete time point t. So for s=1 there is no cum prod.
284 survival = torch.cumprod(1 - hazards, dim=1) #size [1, n_classes]
285
286 return hazards, survival, Y_hat
287
288 def forward(self, h, stage, h_mol):
289

Callers 1

forwardMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected