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

Add unsupervised learning experiments for linear_ntk #83

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

wjmaddox
Copy link
Contributor

@wjmaddox wjmaddox commented Oct 29, 2021

Adds the code to reproduce Figure 7b (olivetti dataset) and Table 1 (unsupervised to supervised experiments) of https://arxiv.org/pdf/2103.01439.pdf that had not been included in the public version previously.

Let me know if I still need to modify licenses / attribution here.

@shuaitang @pgmoren

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link
Contributor

@jnkm jnkm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, there hasn't been activity on this PR in some time. If you're still keen to push this code please address the minor feedback points and we can proceed.

Comment on lines 45 to 46
#model_pars = flatten(model.parameters())
#rand_proj = torch.randn(512, 10).cuda()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably best to remove the commented code in this file


test_images = dataset['test_images']
test_targets = dataset['test_angles']
#test_ids = dataset['test_people_ids']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this line


test_images = dataset['test_images']
test_targets = dataset['test_angles']
#test_ids = dataset['test_people_ids']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can remove this line

Suggested change
#test_ids = dataset['test_people_ids']

@@ -0,0 +1,259 @@
import numpy as np
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing copyright header

@@ -0,0 +1,130 @@
import math
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing copyright header

@@ -0,0 +1,28 @@
import torch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing copyright header

@@ -0,0 +1,76 @@
import math
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing copyright header

Copy link
Contributor

@jnkm jnkm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few remaining commented lines to be removed please.


test_images = dataset['test_images']
test_targets = dataset['test_angles']
#test_ids = dataset['test_people_ids']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#test_ids = dataset['test_people_ids']


###### now train the network
for i in range(args.epochs):
#train_epoch(trainloader, net, gaussian_loglikelihood, optimizer)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#train_epoch(trainloader, net, gaussian_loglikelihood, optimizer)

#### train the last layer
f_optimizer = torch.optim.Adam(frozen_net.parameters(), lr = 1e-3, amsgrad=True)
for i in range(args.adapt_epochs):
#train_epoch(adaptloader, frozen_net, gaussian_loglikelihood, f_optimizer)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#train_epoch(adaptloader, frozen_net, gaussian_loglikelihood, f_optimizer)


##### and finally we "fine-tune" the whole net
for i in range(args.adapt_epochs):
#train_epoch(trainloader, net, gaussian_loglikelihood, optimizer)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#train_epoch(trainloader, net, gaussian_loglikelihood, optimizer)

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.

2 participants