Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There might be a small bug in optimize_prior_precision #248

Open
ruili-pml opened this issue Sep 27, 2024 · 2 comments
Open

There might be a small bug in optimize_prior_precision #248

ruili-pml opened this issue Sep 27, 2024 · 2 comments

Comments

@ruili-pml
Copy link
Contributor

Hi,

There might be a small bug in

targets = targets.view(-1)

as for classification, it requires the target to be the label, instead of one hot vector.

Since in the train_loader it requires one hot vector (or maybe the label also work, in my case I only feed into the one hot vector), it might be consistent to let the val_loader require one hot vector or make both format work?

Best,
Rui

@ruili-pml
Copy link
Contributor Author

Btw, at

interval = torch.logspace(log_prior_prec_min, log_prior_prec_max, grid_size)

as the default base for torch.logspace is 10 (https://pytorch.org/docs/stable/generated/torch.logspace.html), the grid search is in a super large range. I was wondering is it on purpose or? Feels like search in the base of e is more natural.

@wiseodd
Copy link
Collaborator

wiseodd commented Dec 1, 2024

Sorry I missed this issue!

I don't quite get the first issue: In the doc, we specified that the targets tensor follows PyTorch's CrossEntropyLoss convention, i.e. it is an integer tensor of (...) or (..., 1) where ... indicates any leading dimensions (see e.g. this).

As for your second question, I think it's a good point to be more flexible when defining the interval. E.g., we could pass the base parameter of torch.logspace as a method parameter of optimize_prior_precision.

Feel free to open a pull request! (I will eventually work on this, but I have so much in my queue.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants