Skip to content

Conversation

@ltatzel
Copy link
Owner

@ltatzel ltatzel commented Sep 6, 2021

No description provided.

@ltatzel ltatzel requested a review from f-dangel September 6, 2021 15:40
Comment on lines +43 to +69
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
Copy link
Collaborator

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?

Copy link
Owner Author

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)
Copy link
Collaborator

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.

Copy link
Owner Author

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 f-dangel changed the title Adds the noise-free quadratic test problem [ADD] Noise-free quadratic test problem Sep 22, 2021
@ltatzel
Copy link
Owner Author

ltatzel commented Oct 27, 2021

@f-dangel, I tried to incorporate all your comments. Maybe double-check the unresolved conversations before merging this.

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

Successfully merging this pull request may close these issues.

3 participants