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

[BUG] CGNN run() Wrong way to calculate the score #149

Open
Anditty opened this issue Nov 29, 2022 · 1 comment
Open

[BUG] CGNN run() Wrong way to calculate the score #149

Anditty opened this issue Nov 29, 2022 · 1 comment

Comments

@Anditty
Copy link

Anditty commented Nov 29, 2022

Code:

 dataloader = DataLoader(dataset, batch_size=self.batch_size,
                                shuffle=True, drop_last=True,
                                num_workers=dataloader_workers)

        with trange(train_epochs + test_epochs, disable=not verbose) as t:
            for epoch in t:
                for i, data in enumerate(dataloader):
                    optim.zero_grad()
                    generated_data = self.forward()

                    mmd = self.criterion(generated_data, data)
                    if not epoch % 200 and i == 0:
                        t.set_postfix(idx=idx, loss=mmd.item())
                    mmd.backward()
                    optim.step()
                    if epoch >= test_epochs:
                        self.score.add_(mmd.data)

        return self.score.cpu().numpy() / test_epochs

Should change if epoch >= test_epochs: to if epoch >= train_epochs: to calculate the average score of the test set.

@diviyank
Copy link
Collaborator

Hello ! Yes indeed, I'll change this asap.

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

No branches or pull requests

2 participants