-
Notifications
You must be signed in to change notification settings - Fork 1
[ADD] Noise-free quadratic test problem #1
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
base: develop
Are you sure you want to change the base?
Conversation
| def _make_train_and_valid_dataloader(self): | ||
| """Creates the training and validation data loader.""" | ||
|
|
||
| # Training data | ||
| train_data = torch.rand(self._train_size, self._dim) | ||
| train_labels = torch.zeros(self._train_size, self._dim) | ||
| train_dataset = data.TensorDataset(train_data, train_labels) | ||
| train_loader = self._make_dataloader(train_dataset, shuffle=True) | ||
|
|
||
| # Validation data | ||
| valid_data = torch.rand(self._valid_size, self._dim) | ||
| valid_labels = torch.zeros(self._valid_size, self._dim) | ||
| valid_dataset = data.TensorDataset(valid_data, valid_labels) | ||
| valid_loader = self._make_dataloader(valid_dataset) | ||
|
|
||
| return train_loader, valid_loader | ||
|
|
||
| def _make_test_dataloader(self): | ||
| """Creates the test data loader.""" | ||
|
|
||
| # Test data | ||
| test_data = torch.rand(self._test_size, self._dim) | ||
| test_labels = torch.zeros(self._test_size, self._dim) | ||
| test_dataset = data.TensorDataset(test_data, test_labels) | ||
| test_loader = self._make_dataloader(test_dataset) | ||
|
|
||
| return test_loader |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Is it necessary to set random seeds here, or does this happen outside these function in DeepOBS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if DeepOBS takes care of this. But in this case, since the problem is noise-free (inputs are multiplied by zero in the first layer of the network), it doesn't matter, does it?
| labels = labels.to(device) | ||
|
|
||
| # Compare the model's loss with the manually computed loss | ||
| loss_model = loss_function(net(input), labels) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, one should call nf_quadratic.get_batch_loss_and_accuracy_func()() here for the test to be sensitive to changes in the latter. For that one would need access to input, labels. Not sure how to do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, but I don't know how to do this either
|
@f-dangel, I tried to incorporate all your comments. Maybe double-check the unresolved conversations before merging this. |
No description provided.