Comments (10)
Hello, can you produce a minimal reproducible example?
Also, if I understand correctly, the Cox likelihood would be zero in that case so that the log likelihood is not defined.
wouldn't it be one? Can you test with the Breslow approximation?
from lassonet.
I think that if the sets are empty, the log-likelihood is just zero.
from lassonet.
Sorry for the late response. A minimal example would be:
import torch
from lassonet.cox import CoxPHLoss
loss = CoxPHLoss("breslow")
labels = torch.tensor([[5.0, 0], [2.0, 0]])
hazards = torch.tensor([5.0, 2.0])
print(loss(hazards, labels))
#prints nan
loss = CoxPHLoss("efron")
labels = torch.tensor([[5.0, 0], [2.0, 0]])
hazards = torch.tensor([5.0, 2.0])
print(loss(hazards, labels))
#fails with RuntimeError: max(): Expected reduction dim to be specified for input.numel() == 0. Specify the reduction dim with the 'dim' argument.
The error for the Efron method happens because of what I've described above. I think the nan
in the breslow case happens because the likelihood is zero. This can for example be seen from your paper https://arxiv.org/pdf/2208.09793.pdf in equation 1: if all
from lassonet.
from lassonet.
Oh I wasn't aware of that, but yes you're right of course. Then the problem becomes why nan
is returned and not 0.
from lassonet.
from lassonet.
The CoxPHLoss now correctly returns 0. But when I'm trying to use the fixed loss in training I'm getting for batches where all samples have
RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn
from lassonet.
I think I managed to find a better fix :) Can you test again?
from lassonet.
Sorry again for the delay. Yes, it's working now!
from lassonet.
Great!
from lassonet.
Related Issues (20)
- LassoNet for Multitask Learning HOT 1
- LassoNet-Unsupervised Feature Selection HOT 4
- site cannot be reached HOT 1
- Cannot import lassonet HOT 5
- How to Access LassoNet Model Wieghts HOT 4
- Add documentation for LassoNetAutoEncoder HOT 5
- Some errors HOT 2
- Is it possible for y to be multi-dimensional HOT 1
- Running lassonet with CUDA 11.2 HOT 1
- Using the cox loss and methods with cutom model HOT 4
- Large dataset error HOT 11
- Significance of the reported results HOT 3
- Pipeline for reproducing the experiments HOT 1
- Lower accuracy when reproducing the experiments HOT 10
- EarlyStopped HOT 1
- importance values HOT 1
- How can I turn off verbose?
- How will the code react if it is run on a computer with multiple GPUs?
- TypeError: Expected state_dict to be dict-like, got <class 'NoneType'>. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lassonet.