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

[ENH] compare models with and without weight #1669

Open
AdolHong opened this issue Sep 12, 2024 · 1 comment
Open

[ENH] compare models with and without weight #1669

AdolHong opened this issue Sep 12, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@AdolHong
Copy link

sometimes we want to compare model with weight to without weight, but, because the val metric is multiple weight, this multiplication make models cannot be compared.

you can change code below:

file: pytorch_forecasting/models/base_model.py , line 665:

def validation_step(self, batch, batch_idx):
    x, y = batch
    if y[1] is not None:
        weight = torch.where(y[1]!=1.0, torch.tensor(1.0), y[1])
        y = (y[0], weight)
    log, out = self.step(x, y, batch_idx)
    log.update(self.create_log(x, y, out, batch_idx))
    self.validation_step_outputs.append(log)
    return log
@fkiraly fkiraly changed the title compare models with and without weight [ENH] compare models with and without weight Sep 13, 2024
@fkiraly
Copy link
Collaborator

fkiraly commented Sep 13, 2024

Interesting suggestion - a pull request would be appreciated so we can see the change in the context of the current code.

@fkiraly fkiraly added the enhancement New feature or request label Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants