Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MetaRL
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Wang, Mia
MetaRL
Commits
53d0d751
Commit
53d0d751
authored
2 years ago
by
Sun Jin Kim
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of gitlab.doc.ic.ac.uk:yw21218/metarl
parents
9605f53b
1de0f23d
No related branches found
No related tags found
No related merge requests found
Pipeline
#272322
passed
2 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
MetaAugment/autoaugment_learners/aa_learner.py
+23
-1
23 additions, 1 deletion
MetaAugment/autoaugment_learners/aa_learner.py
MetaAugment/autoaugment_learners/evo_learner.py
+6
-6
6 additions, 6 deletions
MetaAugment/autoaugment_learners/evo_learner.py
with
29 additions
and
7 deletions
MetaAugment/autoaugment_learners/aa_learner.py
+
23
−
1
View file @
53d0d751
...
@@ -403,4 +403,26 @@ class aa_learner:
...
@@ -403,4 +403,26 @@ class aa_learner:
self
.
num_pols_tested
+=
1
self
.
num_pols_tested
+=
1
self
.
history
.
append
((
policy
,
accuracy
))
self
.
history
.
append
((
policy
,
accuracy
))
return
accuracy
return
accuracy
\ No newline at end of file
def
get_mega_policy
(
self
,
number_policies
):
"""
Produces a mega policy, based on the n best subpolicies (evo learner)/policies
(other learners)
Args:
number_policies -> int: Number of (sub)policies to be included in the mega
policy
Returns:
megapolicy -> [subpolicy, subpolicy, ...]
"""
inter_pol
=
sorted
(
self
.
history
,
key
=
lambda
x
:
x
[
1
],
reverse
=
True
)[:
number_policies
]
megapol
=
[]
for
pol
in
inter_pol
:
megapol
+=
pol
[
0
]
return
megapol
This diff is collapsed.
Click to expand it.
MetaAugment/autoaugment_learners/evo_learner.py
+
6
−
6
View file @
53d0d751
...
@@ -221,21 +221,21 @@ class evo_learner(aa_learner):
...
@@ -221,21 +221,21 @@ class evo_learner(aa_learner):
self
.
train_loader
=
torch
.
utils
.
data
.
DataLoader
(
train_dataset
,
batch_size
=
self
.
batch_size
)
self
.
train_loader
=
torch
.
utils
.
data
.
DataLoader
(
train_dataset
,
batch_size
=
self
.
batch_size
)
for
idx
,
(
test_x
,
label_x
)
in
enumerate
(
self
.
train_loader
):
for
idx
,
(
test_x
,
label_x
)
in
enumerate
(
self
.
train_loader
):
full
_pol
icy
=
self
.
_get_single_policy_cov
(
test_x
)
sub
_pol
=
self
.
_get_single_policy_cov
(
test_x
)
while
self
.
_in_pol_dict
(
full
_pol
icy
):
while
self
.
_in_pol_dict
(
sub
_pol
):
full
_pol
icy
=
self
.
_get_single_policy_cov
(
test_x
)[
0
]
sub
_pol
=
self
.
_get_single_policy_cov
(
test_x
)[
0
]
fit_val
=
self
.
_test_autoaugment_policy
(
full
_pol
icy
,
child_network_architecture
,
train_dataset
,
test_dataset
)
fit_val
=
self
.
_test_autoaugment_policy
(
sub
_pol
,
child_network_architecture
,
train_dataset
,
test_dataset
)
self
.
running_policy
.
append
((
full_policy
,
fit_val
))
self
.
running_policy
.
append
((
sub_pol
,
fit_val
))
if
len
(
self
.
running_policy
)
>
self
.
sp_num
:
if
len
(
self
.
running_policy
)
>
self
.
sp_num
:
self
.
running_policy
=
sorted
(
self
.
running_policy
,
key
=
lambda
x
:
x
[
1
],
reverse
=
True
)
self
.
running_policy
=
sorted
(
self
.
running_policy
,
key
=
lambda
x
:
x
[
1
],
reverse
=
True
)
self
.
running_policy
=
self
.
running_policy
[:
self
.
sp_num
]
self
.
running_policy
=
self
.
running_policy
[:
self
.
sp_num
]
print
(
"
appended policy:
"
,
self
.
running_policy
)
if
len
(
self
.
history_best
)
==
0
:
if
len
(
self
.
history_best
)
==
0
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment