Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BayesianOptimization
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
Model registry
Operate
Environments
Monitor
Incidents
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
shamith2
BayesianOptimization
Commits
b8ce0ebe
Commit
b8ce0ebe
authored
5 years ago
by
shamith2
Browse files
Options
Downloads
Patches
Plain Diff
changed compare.py
parent
a3c1aec2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
compare.py
+22
-9
22 additions, 9 deletions
compare.py
with
22 additions
and
9 deletions
compare.py
+
22
−
9
View file @
b8ce0ebe
...
...
@@ -25,6 +25,7 @@ def compare_plots(hs_files, fmfn_files):
if
key
==
'
x_input
'
:
x1
=
val
.
data
.
numpy
()
x1
=
x1
[:,
0
]
# fmfn/BayesianOptimization
# read from file
...
...
@@ -46,12 +47,21 @@ def compare_plots(hs_files, fmfn_files):
# load data for visualization
with
open
(
plot_file
)
as
json_file
:
data
=
json
.
load
(
json_file
)
data
=
pd
.
DataFrame
(
json
.
load
(
json_file
)
[
'
logs
'
])
# number of evaluations
x2
=
np
.
arange
(
1
,
len
(
lines
)
+
1
,
1
)
_x
=
data
[
'
params
'
].
to_list
()
dim
=
len
(
_x
[
0
].
values
())
x_list
=
[[]
for
i
in
range
(
dim
)]
for
x_
in
_x
:
for
i
in
range
(
dim
):
x_list
[
i
].
append
(
tuple
(
x_
.
values
())[
i
])
x_n_eval
=
np
.
arange
(
1
,
len
(
lines
)
+
1
,
1
)
# x_input
x2
=
x_list
[
0
]
# y = f(x)
y2
=
pd
.
DataFrame
(
data
[
'
logs
'
]
)
.
to_numpy
()
[:,
0
]
y2
=
data
[
'
target
'
].
to_numpy
()
# visualization
my_plt
.
figure
(
'
HyperSphere vs fmfn
'
)
...
...
@@ -60,21 +70,24 @@ def compare_plots(hs_files, fmfn_files):
blue
=
my_patch
.
Patch
(
color
=
'
blue
'
,
label
=
'
fmfn
'
)
my_plt
.
legend
(
handles
=
[
red
,
blue
])
my_plt
.
plot
(
x1
[:,
0
]
,
y1
,
'
r
'
)
my_plt
.
plot
(
x1
,
y1
,
'
r
'
)
my_plt
.
plot
(
x2
,
y2
,
'
b
'
)
my_plt
.
axhline
(
y
=-
106.76
)
my_plt
.
show
()
if
__name__
==
'
__main__
'
:
# parameters
geometry
=
'
sphere
'
func
=
'
branin
'
func
=
'
birdy
'
fmfn_func
=
'
neg_birdy
'
d
=
'
2
'
e
=
'
2
'
e
=
'
50
'
# subprocess
hs
=
subprocess
.
Popen
(
args
=
[
'
python
'
,
'
HyperSphere/BO/run_BO.py
'
,
'
-g
'
,
geometry
,
'
--origin
'
,
'
--warping
'
,
hs
=
subprocess
.
Popen
(
args
=
[
'
python
'
,
'
HyperSphere/BO/run_BO.py
'
,
'
-g
'
,
geometry
,
'
--parallel
'
,
'
-f
'
,
func
,
'
-d
'
,
d
,
'
-e
'
,
e
],
stdout
=
subprocess
.
PIPE
,
universal_newlines
=
True
)
while
True
:
...
...
@@ -86,7 +99,7 @@ if __name__ == '__main__':
if
return_code
is
not
None
:
break
fmfn
=
subprocess
.
Popen
(
args
=
[
'
python
'
,
'
fmfnBO/runBO.py
'
,
'
-f
'
,
str
(
func
),
'
-d
'
,
str
(
d
),
fmfn
=
subprocess
.
Popen
(
args
=
[
'
python
'
,
'
fmfnBO/runBO.py
'
,
'
-f
'
,
str
(
fmfn_
func
),
'
-d
'
,
str
(
d
),
'
-e
'
,
str
(
e
)],
stdout
=
subprocess
.
PIPE
,
universal_newlines
=
True
)
while
True
:
...
...
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