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

Benchmaking for multi-objectives samplers #3271

Merged

Conversation

drumehiron
Copy link
Contributor

@drumehiron drumehiron commented Jan 30, 2022

Motivation

#3245

Description of the changes

This PR is extend 'optuna/benchmarks/run_kurobako.py' to multi-objectives.

TODOs:

  • fix --sampler-kwargs-list argument

@nzw0301 nzw0301 added v3 Issue/PR for Optuna version 3. sprint-20220130 PR from the online sprint event Jan 30, 2022. labels Jan 30, 2022
@codecov-commenter
Copy link

codecov-commenter commented Jan 30, 2022

Codecov Report

Merging #3271 (0d7e03a) into master (2a208f0) will decrease coverage by 0.31%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #3271      +/-   ##
==========================================
- Coverage   91.84%   91.53%   -0.32%     
==========================================
  Files         156      158       +2     
  Lines       12292    12195      -97     
==========================================
- Hits        11290    11163     -127     
- Misses       1002     1032      +30     
Impacted Files Coverage Δ
...a/visualization/matplotlib/_parallel_coordinate.py 98.37% <0.00%> (-1.63%) ⬇️
optuna/visualization/_pareto_front.py 98.57% <0.00%> (-1.43%) ⬇️
optuna/integration/chainermn.py 93.93% <0.00%> (-1.22%) ⬇️
optuna/_transform.py 94.44% <0.00%> (-0.88%) ⬇️
optuna/integration/botorch.py 97.80% <0.00%> (-0.88%) ⬇️
optuna/samplers/nsgaii/_sampler.py 95.33% <0.00%> (-0.85%) ⬇️
optuna/samplers/nsgaii/_crossover.py 91.17% <0.00%> (-0.61%) ⬇️
optuna/integration/tensorboard.py 91.30% <0.00%> (-0.54%) ⬇️
optuna/visualization/matplotlib/_utils.py 95.65% <0.00%> (-0.51%) ⬇️
optuna/integration/skopt.py 98.08% <0.00%> (-0.29%) ⬇️
... and 33 more

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@HideakiImamura
Copy link
Member

Thanks for the PR! I'd like to investigate how to use sampler-kwargs-list.

@HideakiImamura HideakiImamura added the feature Change that does not break compatibility, but affects the public interfaces. label Feb 8, 2022
Copy link
Member

@HideakiImamura HideakiImamura left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! I made some modifications to make it work with the latest Optuna version. Check it out!

benchmarks/mo_runner.py Outdated Show resolved Hide resolved
benchmarks/mo_runner.py Outdated Show resolved Hide resolved
benchmarks/mo_runner.py Outdated Show resolved Hide resolved
benchmarks/mo_runner.py Outdated Show resolved Hide resolved
benchmarks/mo_runner.py Outdated Show resolved Hide resolved
benchmarks/run_mo_kurobako.py Outdated Show resolved Hide resolved
benchmarks/run_mo_kurobako.py Outdated Show resolved Hide resolved
benchmarks/run_mo_kurobako.py Outdated Show resolved Hide resolved
benchmarks/run_mo_kurobako.py Outdated Show resolved Hide resolved
benchmarks/run_mo_kurobako.py Outdated Show resolved Hide resolved
@HideakiImamura
Copy link
Member

@drumehiron PTAL!

@drumehiron
Copy link
Contributor Author

Sorry for the late reply and thank you for review.
I check your review.

drumehiron and others added 16 commits February 16, 2022 13:44
Co-authored-by: Hideaki Imamura <38826298+HideakiImamura@users.noreply.github.com>
Co-authored-by: Hideaki Imamura <38826298+HideakiImamura@users.noreply.github.com>
Co-authored-by: Hideaki Imamura <38826298+HideakiImamura@users.noreply.github.com>
Co-authored-by: Hideaki Imamura <38826298+HideakiImamura@users.noreply.github.com>
Co-authored-by: Hideaki Imamura <38826298+HideakiImamura@users.noreply.github.com>
Co-authored-by: Hideaki Imamura <38826298+HideakiImamura@users.noreply.github.com>
Co-authored-by: Hideaki Imamura <38826298+HideakiImamura@users.noreply.github.com>
Co-authored-by: Hideaki Imamura <38826298+HideakiImamura@users.noreply.github.com>
Co-authored-by: Hideaki Imamura <38826298+HideakiImamura@users.noreply.github.com>
Co-authored-by: Hideaki Imamura <38826298+HideakiImamura@users.noreply.github.com>
Co-authored-by: Hideaki Imamura <38826298+HideakiImamura@users.noreply.github.com>
Co-authored-by: Hideaki Imamura <38826298+HideakiImamura@users.noreply.github.com>
Co-authored-by: Hideaki Imamura <38826298+HideakiImamura@users.noreply.github.com>
Co-authored-by: Hideaki Imamura <38826298+HideakiImamura@users.noreply.github.com>
Co-authored-by: Hideaki Imamura <38826298+HideakiImamura@users.noreply.github.com>

# Create study.
cmd = (
f"{kurobako_cmd} studies --budget 300 "
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have confirmed that it works well on my computer with --budget 10 .
In the case of -- budget 300, the computation time is too long, so I haven't checked if it works properly yet.

Copy link
Member

Choose a reason for hiding this comment

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

Agree. How about using the same budget with the existing single-objective one? It is 80. https://github.com/optuna/optuna/blob/master/benchmarks/run_kurobako.py#L69

@HideakiImamura
Copy link
Member

You can fix the CI error of Checks by formatting.

$ bash formats.sh

@drumehiron
Copy link
Contributor Author

@nzw0301 Thank you for your review. I fix the points.

Copy link
Member

@HideakiImamura HideakiImamura left a comment

Choose a reason for hiding this comment

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

Thanks for the update. I have several comment mainly to enable the sampler-kwargs option. Please take a look.

benchmarks/mo_create_study.py Outdated Show resolved Hide resolved
benchmarks/mo_create_study.py Outdated Show resolved Hide resolved
benchmarks/run_mo_kurobako.py Outdated Show resolved Hide resolved
benchmarks/run_mo_kurobako.py Outdated Show resolved Hide resolved
benchmarks/run_mo_kurobako.py Outdated Show resolved Hide resolved
benchmarks/run_mo_kurobako.py Outdated Show resolved Hide resolved

os.makedirs(args.out_dir, exist_ok=True)
study_json_filename = os.path.join(args.out_dir, "studies.json")
subprocess.check_call(f"echo >| {study_json_filename}", shell=True)
Copy link
Member

Choose a reason for hiding this comment

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

Looks good not to use -n option since it does not work in macOS.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for checking it.

drumehiron and others added 6 commits April 16, 2022 11:06
Co-authored-by: Hideaki Imamura <38826298+HideakiImamura@users.noreply.github.com>
Co-authored-by: Hideaki Imamura <38826298+HideakiImamura@users.noreply.github.com>
Co-authored-by: Hideaki Imamura <38826298+HideakiImamura@users.noreply.github.com>
Co-authored-by: Hideaki Imamura <38826298+HideakiImamura@users.noreply.github.com>
Co-authored-by: Hideaki Imamura <38826298+HideakiImamura@users.noreply.github.com>
Co-authored-by: Hideaki Imamura <38826298+HideakiImamura@users.noreply.github.com>
Copy link
Contributor Author

@drumehiron drumehiron left a comment

Choose a reason for hiding this comment

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

Thank you for review. I checked it.


os.makedirs(args.out_dir, exist_ok=True)
study_json_filename = os.path.join(args.out_dir, "studies.json")
subprocess.check_call(f"echo >| {study_json_filename}", shell=True)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for checking it.

@drumehiron
Copy link
Contributor Author

I share the graphs obtained by running the program locally.

Results

NASBench(A)

nasbench-a-randomsampler-1c7bd31546a52475c4b4f00abd51e68b6fa14baa818299ea2ec51f12703e0f81

nasbench-a-nsgaiisampler-896bca5b8d4113220433e09568af66be3023b7d0b47e741696a856e8f5b2d928

nasbench-a-tpesampler-ffccd9f8c4a9aab456766bd27c3197082fdb1999cc690dda5ac2a539d8f7c0de

ZDT1

zdt1-randomsampler-86e032ff35d1b5654753829bd6cc20ce1b632aa11603652116c410c244756a7b

zdt1-nsgaiisampler-31990e8998f721570b72be72bb3d479d8d4800e4af3084ad4bc95cac2548ab52

zdt1-tpesampler-3c0bc4817ace50b5fac49c7f9f57f078ca1c0655302582023310f3fc69ad986d

ZDT2

zdt2-randomsampler-de42e245cdf524596a564993f7f507a985030a6e7aec4203745814c45843c5b6
zdt2-nsgaiisampler-2a2e1baae5b4a6d2965efc144e8b27589b5572b056d5effda7cffdb27a53d392
zdt2-tpesampler-e2ccd295015f6120f4e2fc39a3ff1cf2286036c6fae5b2af8bf88ebe5a7fb1dd

ZDT3

zdt3-randomsampler-b39795858f4f0ada27a818eb43012e270d54df80975da961484d8583d85e210a
zdt3-nsgaiisampler-d3fbf8e2a0362be1e84132f591dbaf8d24dbf110f228dc8563363623a4f12384
zdt3-tpesampler-c7bf2436cb6b63fa64e83894fe887c5ebc5e279e08a12f4c0b403f8c2bc8f18e

ZDT4

zdt4-randomsampler-8d80b3b5de53e7beec7dc277ae11f6f59e55d72ef75df2ebff9026b692f88669

zdt4-nsgaiisampler-f04dcae2c25f73a2705d2d6a908bb6fa349ae10ebefa3afdb1b8bbff12eedf68

zdt4-tpesampler-24e89f311b6c0eabe31420949c8a89450825b43550ed0001d97bee7f47c6bfb3

ZDT5

zdt5-randomsampler-e3c1162ca5533dbca443ecda345a0e0ad6f2977f81f1fe6cdbcad49526cf7303

zdt5-nsgaiisampler-8f790328245e8e701e6e8cd06da1fd99b13aa5ccb063519a2aac62532743fd38

zdt5-tpesampler-8bba257f9b552135e3898209d0d42c16ce9678f4274632c1941d08d79d28d5b5

ZDT6

zdt6-randomsampler-7c8042f981ed8e6d37b6dfec2d9e0afca4bdcf577a828a0c1c3167abe0aa2315

zdt6-nsgaiisampler-afe417ec4d4b4e6a1332b77a44dbe5b4d7282bb6624c965eb213ad183ad7bf3f

zdt6-tpesampler-0a2d14640e3ca5fafa9802dd461d12a91d944872deb034384ae2a72003a38464

@HideakiImamura
Copy link
Member

@contramundum53 Could you review this PR if you have time?

Copy link
Member

@HideakiImamura HideakiImamura left a comment

Choose a reason for hiding this comment

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

Thanks for the update! Almost, LGTM. I have several minor comments. PTAL.

@@ -0,0 +1,44 @@
import json
Copy link
Member

Choose a reason for hiding this comment

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

The benchmarks directory becomes a bit complicated. How about creating a benchmarks/kurobako directory and moving mo_create_study.py into this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree your comments. I move mo_create_study.py into into benchmarks/kurobako.

benchmarks/mo_create_study.py Outdated Show resolved Hide resolved
benchmarks/run_mo_kurobako.py Outdated Show resolved Hide resolved
Copy link
Member

@contramundum53 contramundum53 left a comment

Choose a reason for hiding this comment

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

Thanks for your PR! It looks almost good to me. I left some minor comments.

benchmarks/run_mo_kurobako.py Outdated Show resolved Hide resolved
benchmarks/run_mo_kurobako.py Outdated Show resolved Hide resolved
benchmarks/run_mo_kurobako.py Outdated Show resolved Hide resolved
Copy link
Contributor Author

@drumehiron drumehiron left a comment

Choose a reason for hiding this comment

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

Thank you for review. I will update this PR.

@@ -0,0 +1,44 @@
import json
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree your comments. I move mo_create_study.py into into benchmarks/kurobako.

benchmarks/mo_create_study.py Outdated Show resolved Hide resolved
benchmarks/run_mo_kurobako.py Outdated Show resolved Hide resolved
benchmarks/run_mo_kurobako.py Outdated Show resolved Hide resolved
Co-authored-by: Hideaki Imamura <38826298+HideakiImamura@users.noreply.github.com>
Co-authored-by: contramundum53 <contramundum53@outlook.com>
@nzw0301 nzw0301 requested a review from a team April 19, 2022 12:05
@himkt himkt requested review from a team and removed request for a team April 19, 2022 12:25
@drumehiron
Copy link
Contributor Author

I share the graphs obtained by running the program locally. NSGA-II seems to be behaving better.

NAS Bench

nasbench-a-randomsampler-1b4ee96b52429f91f3d568cb495d6aefc737bd7283867abd7dbf4e3f84ee2636

nasbench-a-nsgaiisampler-43161816893134c184b8a635cd049cfc24970811659b0e55c99861b71a9f9786

nasbench-a-tpesampler-e793c22f63b87027c2a37820263cab7ade42dd172c7abccd759a7f7f4ddfe775

ZDT1

zdt1-randomsampler-c172753ed599a19d9ee04801069bf07724f21af549892849062aeff8fa78ed04

zdt1-nsgaiisampler-062702bb0530d691c615c3d79402539bf4e0792e4ab6077033a1669aef1c5960

zdt1-tpesampler-ee52859e8ee615ef9ac3ac1f4e3067a9cb864a84f02c918d61d9bbd4290313b8

ZDT2

zdt2-randomsampler-0cc7b8fe53a63b12599b00b78a042204da264bb705e1f692c2254a534b28d8bd

zdt2-nsgaiisampler-37c6c3d41cfdbfd5c874e53cfcdeaccec86b7540cdd9c6ce60b85d84054f5cf3

zdt2-tpesampler-e2ba32b9808b0058363379c51ad4fc778b47f40750b9eda06b47e29b01b1da18

ZDT3

zdt3-randomsampler-84cafeeda7ed51e572324a219c9aab46b26ecf37a07a35295867ae8a2a4387d5
zdt3-nsgaiisampler-bbdccb93ce6ebf5860610e6ce1e78c949754acf3299adcfd65e7dd738ab74c5e
zdt3-tpesampler-2de1fca7d592bdceffa6e145694b7b70aa6dcb94e807589a7eabe2a1d974653f

ZDT4

zdt4-randomsampler-2a8a86bbd7ec974913f37e1a8d2ad1f7224473fd36526faa57dd601addbf46fe

zdt4-nsgaiisampler-850c9e57c9e7b2e0ae8db0b443c350e359e33a476082208e86be88d307a02e7c

zdt4-tpesampler-ddac64ba539ced4764fe5561cbb34f400408e2129e3efa54e94e8f3e93aae475

ZDT5

zdt5-randomsampler-11f3701d36d8cdf6c370aa2ed262e5cf345d4b49fb344109336bccd684febef4

zdt5-nsgaiisampler-cb0cda6329716454d1edaafecad98d2e7bd758647b78148eed26f7ff9a50b27d

zdt5-tpesampler-29c17cff0a3e3223a0bb53c5dd37f2a7ec57436384f3aa34ba8187d9331d7b01

ZDT6

zdt6-randomsampler-2aba1d35972c6e95106e4b4550f6e41f7afd0ec085a5db2c11edb46934d28f97

zdt6-nsgaiisampler-0db755f627a57014946365bf9a8ad1ee79550cd4e666dd8ce769173558c0e493

zdt6-tpesampler-94cf5a38e7617ff6cbdffb4add11aa4e3cdb0a9ea2718af69b64b9cc3c9cee05

Copy link
Member

@contramundum53 contramundum53 left a comment

Choose a reason for hiding this comment

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

Thank you!

@contramundum53
Copy link
Member

Maybe we should also change the single-objective version to have budget 120 for consistency, but I think that can be another PR.

@contramundum53 contramundum53 merged commit 97f29ce into optuna:master Apr 28, 2022
@knshnb knshnb added this to the v3.0.0-b1 milestone Jun 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Change that does not break compatibility, but affects the public interfaces. sprint-20220130 PR from the online sprint event Jan 30, 2022. v3 Issue/PR for Optuna version 3.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants