Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
LIN Julien
sho
Commits
9d228b9e
Commit
9d228b9e
authored
Oct 18, 2021
by
Julien Lin
Browse files
format code
parent
68085337
Changes
1
Hide whitespace changes
Inline
Side-by-side
eaf.py
View file @
9d228b9e
...
...
@@ -7,14 +7,19 @@ from joblib import Parallel, delayed
num_cores
=
multiprocessing
.
cpu_count
()
def
get_args_parse
():
can
=
argparse
.
ArgumentParser
()
can
.
add_argument
(
"--nb-run"
,
type
=
int
,
default
=
10
,
help
=
"number of runs"
)
can
.
add_argument
(
"--quality-threshold"
,
type
=
float
,
default
=
600
,
help
=
"Quality threshold"
)
can
.
add_argument
(
"--not-parallel"
,
type
=
bool
,
default
=
False
,
help
=
"launch runs sequentialy"
)
can
.
add_argument
(
"--quality-threshold"
,
type
=
float
,
default
=
600
,
help
=
"Quality threshold"
)
can
.
add_argument
(
"--not-parallel"
,
type
=
bool
,
default
=
False
,
help
=
"launch runs sequentialy"
)
can
.
add_argument
(
"--solver"
,
type
=
str
,
default
=
"num_random"
,
help
=
"Solver to use."
)
...
...
@@ -23,7 +28,6 @@ def get_args_parse():
def
main
():
can
=
get_args_parse
()
the
=
can
.
parse_args
()
...
...
@@ -34,14 +38,14 @@ def main():
results
=
[]
for
i
in
range
(
the
.
nb_run
):
# print(f"{i}th run")
results
.
append
(
run
(
args
)
)
results
.
append
(
run
(
args
))
else
:
def
f
(
i
):
# print(f"{i}th run")
return
run
(
args
)
results
=
Parallel
(
n_jobs
=
num_cores
)(
delayed
(
f
)(
i
)
for
i
in
range
(
the
.
nb_run
))
return
run
(
args
)
results
=
Parallel
(
n_jobs
=
num_cores
)(
delayed
(
f
)(
i
)
for
i
in
range
(
the
.
nb_run
))
fig
=
plt
.
figure
()
...
...
@@ -51,9 +55,9 @@ def main():
values
=
sorted
(
values
,
key
=
lambda
el
:
el
[
1
])
t
=
[
iter
for
_
,
iter
in
values
]
values
=
np
.
array
([
val
for
val
,
_
in
values
])
values
=
np
.
cumsum
(
values
>=
the
.
quality_threshold
)
/
len
(
values
)
t
=
[
iter
for
_
,
iter
in
values
]
values
=
np
.
array
([
val
for
val
,
_
in
values
])
values
=
np
.
cumsum
(
values
>=
the
.
quality_threshold
)
/
len
(
values
)
ax3
.
step
(
t
,
values
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment