-
Notifications
You must be signed in to change notification settings - Fork 63
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
base: master
Are you sure you want to change the base?
Conversation
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.
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.
#model_pars = flatten(model.parameters()) | ||
#rand_proj = torch.randn(512, 10).cuda() |
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.
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'] |
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.
Remove this line
|
||
test_images = dataset['test_images'] | ||
test_targets = dataset['test_angles'] | ||
#test_ids = dataset['test_people_ids'] |
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.
Can remove this line
#test_ids = dataset['test_people_ids'] |
@@ -0,0 +1,259 @@ | |||
import numpy as np |
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.
Missing copyright header
@@ -0,0 +1,130 @@ | |||
import math |
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.
Missing copyright header
@@ -0,0 +1,28 @@ | |||
import torch |
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.
Missing copyright header
@@ -0,0 +1,76 @@ | |||
import math |
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.
Missing copyright header
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.
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'] |
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.
#test_ids = dataset['test_people_ids'] |
|
||
###### now train the network | ||
for i in range(args.epochs): | ||
#train_epoch(trainloader, net, gaussian_loglikelihood, optimizer) |
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.
#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) |
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.
#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) |
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.
#train_epoch(trainloader, net, gaussian_loglikelihood, optimizer) |
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.