-
Notifications
You must be signed in to change notification settings - Fork 5
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 nelder-mead sampler #346
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.
PRありがとうございます.
全体的にAnyが多いのが気になりますが,Simplex等の入力はfloat32, 64等の数値型だと思うので,極力Anyを減らして貰ってもよいでしょうか?
特に | Any
となっている部分は,型を付けていないのと同じになってしまうので,やむを得ない場合を除き,割けるべきだと思います.
mypy
のチェックが厳しすぎる系の話であれば,そちらの設定を修正した方が良いと思うので,ミーティング等でご指摘下さい.
sampler test をpytest に移行しました。 |
開発者会議メモ
|
@yoshipon |
sub_sampler 用の study を sub_sampler の before_trial, sample_independent, after_trial に置き換える場合の懸念点
|
sub_study を削除して、sub_sampler の before_trial, sample_independent, after_trial を呼び出す形に改修しました。 テストコード中のクラスにする必要のない箇所のクラス削除、部分的にしか利用していない fixture の削除を行いました。 |
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.
修正ありがとうございます.何点かコメントさせて頂きました.
これらを修正頂いた段階で,一旦このPRはマージできればと思います.
よろしくお願いします.
Co-authored-by: Yoshiaki Bando <yoshipon@users.noreply.github.com>
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.
ありがとうございました!
* add nelder_mead_sampler.py --------- Co-authored-by: Yoshiaki Bando <yoshipon@users.noreply.github.com>
* Add nelder-mead sampler (#346) * add nelder_mead_sampler.py --------- Co-authored-by: Yoshiaki Bando <yoshipon@users.noreply.github.com> * Add -e. (#371) * Support for suggest_int in neldermead sampler. (#373) * Support for suggest_int. * Fix for ruff. * Add Job dispatcher (#360) * Update aiaccel/job * fix lint error * fix aiaccel/job/dispatcher.py * wip * Fix issues pointed out in review * rename * fix test * fix for test * fix for test * fix for test * fix for test * Reflected code review feedback * fix test * fix test * refactoring * Run code formatter ruff * refactoring * Run code formatter ruff * fix lint.yaml * fix pypoject.toml * fix mypy.ini * fix mypy.ini * fix mypy.ini * fix mypy.ini * fix mypy.ini * Refactor abci jobs * Update pyproject.toml * adjusted to work in the ABCI environment. * fix lint error * fix test * fix test * Changed from unittest to pytest * Incorporate revisions based on review feedback * Add test items * fix test * fix test * fix test * remove __future__.annotations * A bit simplify qstat_xml * Simplify tests --------- Co-authored-by: Yoshiaki Bando <yoshipon@users.noreply.github.com> * Add ignore_missing_imports. (#376) * Draft Implementation of CLI Command (#369) * Update aiaccel/job * fix lint error * fix aiaccel/job/dispatcher.py * wip * Fix issues pointed out in review * rename * fix test * fix for test * fix for test * fix for test * fix for test * Reflected code review feedback * fix test * fix test * refactoring * Run code formatter ruff * refactoring * Run code formatter ruff * fix lint.yaml * fix pypoject.toml * fix mypy.ini * fix mypy.ini * fix mypy.ini * fix mypy.ini * fix mypy.ini * Refactor abci jobs * Update pyproject.toml * adjusted to work in the ABCI environment. * fix lint error * fix test * fix test * Changed from unittest to pytest * Incorporate revisions based on review feedback * Add test items * Add 'start.py' * Fix code format * update pyproject.toml * Remove unnecessary items from config * Add random seed option * Refactor examples/start.py into aiaccel/apps/optimize.py * fix lint errors and warnings * remove apps/config * fix typo * change config.yaml format * fix apps/optimizer * fix HparamManager __init__ * fix HparamsManager * Refactor Suggest class to use generics for improved type safety * auto fix by ruff * add optuna suggest wrapper * format fix * Update wrapper.py --------- Co-authored-by: Yoshiaki Bando <yoshipon@users.noreply.github.com> * Add nm docstring and move file (#381) * Add docstring. * Move nelder_mead_sampler.py. * Fix path. * Move test files. * autoformat and fix mypy error * Add v2 torch docstring (#384) * add docstring * Update abci_environment.py --------- Co-authored-by: Yoshiaki Bando <yoshipon@users.noreply.github.com> --------- Co-authored-by: KanaiYuma-aist <105629713+KanaiYuma-aist@users.noreply.github.com> Co-authored-by: Yoshiaki Bando <yoshipon@users.noreply.github.com>
* Add nelder-mead sampler (#346) * add nelder_mead_sampler.py --------- Co-authored-by: Yoshiaki Bando <yoshipon@users.noreply.github.com> * Add -e. (#371) * Support for suggest_int in neldermead sampler. (#373) * Support for suggest_int. * Fix for ruff. * Add Job dispatcher (#360) * Update aiaccel/job * fix lint error * fix aiaccel/job/dispatcher.py * wip * Fix issues pointed out in review * rename * fix test * fix for test * fix for test * fix for test * fix for test * Reflected code review feedback * fix test * fix test * refactoring * Run code formatter ruff * refactoring * Run code formatter ruff * fix lint.yaml * fix pypoject.toml * fix mypy.ini * fix mypy.ini * fix mypy.ini * fix mypy.ini * fix mypy.ini * Refactor abci jobs * Update pyproject.toml * adjusted to work in the ABCI environment. * fix lint error * fix test * fix test * Changed from unittest to pytest * Incorporate revisions based on review feedback * Add test items * fix test * fix test * fix test * remove __future__.annotations * A bit simplify qstat_xml * Simplify tests --------- Co-authored-by: Yoshiaki Bando <yoshipon@users.noreply.github.com> * Add ignore_missing_imports. (#376) * Draft Implementation of CLI Command (#369) * Update aiaccel/job * fix lint error * fix aiaccel/job/dispatcher.py * wip * Fix issues pointed out in review * rename * fix test * fix for test * fix for test * fix for test * fix for test * Reflected code review feedback * fix test * fix test * refactoring * Run code formatter ruff * refactoring * Run code formatter ruff * fix lint.yaml * fix pypoject.toml * fix mypy.ini * fix mypy.ini * fix mypy.ini * fix mypy.ini * fix mypy.ini * Refactor abci jobs * Update pyproject.toml * adjusted to work in the ABCI environment. * fix lint error * fix test * fix test * Changed from unittest to pytest * Incorporate revisions based on review feedback * Add test items * Add 'start.py' * Fix code format * update pyproject.toml * Remove unnecessary items from config * Add random seed option * Refactor examples/start.py into aiaccel/apps/optimize.py * fix lint errors and warnings * remove apps/config * fix typo * change config.yaml format * fix apps/optimizer * fix HparamManager __init__ * fix HparamsManager * Refactor Suggest class to use generics for improved type safety * auto fix by ruff * add optuna suggest wrapper * format fix * Update wrapper.py --------- Co-authored-by: Yoshiaki Bando <yoshipon@users.noreply.github.com> * Add nm docstring and move file (#381) * Add docstring. * Move nelder_mead_sampler.py. * Fix path. * Move test files. * autoformat and fix mypy error * Add v2 torch docstring (#384) * add docstring * Update abci_environment.py --------- Co-authored-by: Yoshiaki Bando <yoshipon@users.noreply.github.com> --------- Co-authored-by: KanaiYuma-aist <105629713+KanaiYuma-aist@users.noreply.github.com> Co-authored-by: Yoshiaki Bando <yoshipon@users.noreply.github.com>
* Add nelder-mead sampler (#346) * add nelder_mead_sampler.py --------- Co-authored-by: Yoshiaki Bando <yoshipon@users.noreply.github.com> * Add -e. (#371) * Support for suggest_int in neldermead sampler. (#373) * Support for suggest_int. * Fix for ruff. * Add Job dispatcher (#360) * Update aiaccel/job * fix lint error * fix aiaccel/job/dispatcher.py * wip * Fix issues pointed out in review * rename * fix test * fix for test * fix for test * fix for test * fix for test * Reflected code review feedback * fix test * fix test * refactoring * Run code formatter ruff * refactoring * Run code formatter ruff * fix lint.yaml * fix pypoject.toml * fix mypy.ini * fix mypy.ini * fix mypy.ini * fix mypy.ini * fix mypy.ini * Refactor abci jobs * Update pyproject.toml * adjusted to work in the ABCI environment. * fix lint error * fix test * fix test * Changed from unittest to pytest * Incorporate revisions based on review feedback * Add test items * fix test * fix test * fix test * remove __future__.annotations * A bit simplify qstat_xml * Simplify tests --------- Co-authored-by: Yoshiaki Bando <yoshipon@users.noreply.github.com> * Add ignore_missing_imports. (#376) * Draft Implementation of CLI Command (#369) * Update aiaccel/job * fix lint error * fix aiaccel/job/dispatcher.py * wip * Fix issues pointed out in review * rename * fix test * fix for test * fix for test * fix for test * fix for test * Reflected code review feedback * fix test * fix test * refactoring * Run code formatter ruff * refactoring * Run code formatter ruff * fix lint.yaml * fix pypoject.toml * fix mypy.ini * fix mypy.ini * fix mypy.ini * fix mypy.ini * fix mypy.ini * Refactor abci jobs * Update pyproject.toml * adjusted to work in the ABCI environment. * fix lint error * fix test * fix test * Changed from unittest to pytest * Incorporate revisions based on review feedback * Add test items * Add 'start.py' * Fix code format * update pyproject.toml * Remove unnecessary items from config * Add random seed option * Refactor examples/start.py into aiaccel/apps/optimize.py * fix lint errors and warnings * remove apps/config * fix typo * change config.yaml format * fix apps/optimizer * fix HparamManager __init__ * fix HparamsManager * Refactor Suggest class to use generics for improved type safety * auto fix by ruff * add optuna suggest wrapper * format fix * Update wrapper.py --------- Co-authored-by: Yoshiaki Bando <yoshipon@users.noreply.github.com> * Add nm docstring and move file (#381) * Add docstring. * Move nelder_mead_sampler.py. * Fix path. * Move test files. * autoformat and fix mypy error * Add v2 torch docstring (#384) * add docstring * Update abci_environment.py --------- Co-authored-by: Yoshiaki Bando <yoshipon@users.noreply.github.com> --------- Co-authored-by: KanaiYuma-aist <105629713+KanaiYuma-aist@users.noreply.github.com> Co-authored-by: Yoshiaki Bando <yoshipon@users.noreply.github.com>
* Add torch goodies * Add type annotations * Add small things * update for mypy * Add several tests * add test for hdf5_dataset.py * Update workflows * Add tests * update workflows * add dependencies * update train.py * add opt_lightning_module * add opt_lightning_module * Update error messages! * Update hdf5_dataset to take grp_list as argument * sort grp_list * update v2 torch (#383) * Add nelder-mead sampler (#346) * add nelder_mead_sampler.py --------- Co-authored-by: Yoshiaki Bando <yoshipon@users.noreply.github.com> * Add -e. (#371) * Support for suggest_int in neldermead sampler. (#373) * Support for suggest_int. * Fix for ruff. * Add Job dispatcher (#360) * Update aiaccel/job * fix lint error * fix aiaccel/job/dispatcher.py * wip * Fix issues pointed out in review * rename * fix test * fix for test * fix for test * fix for test * fix for test * Reflected code review feedback * fix test * fix test * refactoring * Run code formatter ruff * refactoring * Run code formatter ruff * fix lint.yaml * fix pypoject.toml * fix mypy.ini * fix mypy.ini * fix mypy.ini * fix mypy.ini * fix mypy.ini * Refactor abci jobs * Update pyproject.toml * adjusted to work in the ABCI environment. * fix lint error * fix test * fix test * Changed from unittest to pytest * Incorporate revisions based on review feedback * Add test items * fix test * fix test * fix test * remove __future__.annotations * A bit simplify qstat_xml * Simplify tests --------- Co-authored-by: Yoshiaki Bando <yoshipon@users.noreply.github.com> * Add ignore_missing_imports. (#376) * Draft Implementation of CLI Command (#369) * Update aiaccel/job * fix lint error * fix aiaccel/job/dispatcher.py * wip * Fix issues pointed out in review * rename * fix test * fix for test * fix for test * fix for test * fix for test * Reflected code review feedback * fix test * fix test * refactoring * Run code formatter ruff * refactoring * Run code formatter ruff * fix lint.yaml * fix pypoject.toml * fix mypy.ini * fix mypy.ini * fix mypy.ini * fix mypy.ini * fix mypy.ini * Refactor abci jobs * Update pyproject.toml * adjusted to work in the ABCI environment. * fix lint error * fix test * fix test * Changed from unittest to pytest * Incorporate revisions based on review feedback * Add test items * Add 'start.py' * Fix code format * update pyproject.toml * Remove unnecessary items from config * Add random seed option * Refactor examples/start.py into aiaccel/apps/optimize.py * fix lint errors and warnings * remove apps/config * fix typo * change config.yaml format * fix apps/optimizer * fix HparamManager __init__ * fix HparamsManager * Refactor Suggest class to use generics for improved type safety * auto fix by ruff * add optuna suggest wrapper * format fix * Update wrapper.py --------- Co-authored-by: Yoshiaki Bando <yoshipon@users.noreply.github.com> * Add nm docstring and move file (#381) * Add docstring. * Move nelder_mead_sampler.py. * Fix path. * Move test files. * autoformat and fix mypy error * Add v2 torch docstring (#384) * add docstring * Update abci_environment.py --------- Co-authored-by: Yoshiaki Bando <yoshipon@users.noreply.github.com> --------- Co-authored-by: KanaiYuma-aist <105629713+KanaiYuma-aist@users.noreply.github.com> Co-authored-by: Yoshiaki Bando <yoshipon@users.noreply.github.com> * Add torch goodies * Add type annotations * Add small things * update for mypy * Add several tests * add test for hdf5_dataset.py * Update workflows * Add tests * update workflows * add dependencies * update train.py * add opt_lightning_module * Update error messages! * add opt_lightning_module * Update hdf5_dataset to take grp_list as argument * sort grp_list * update v2 torch (#383) * Add nelder-mead sampler (#346) * add nelder_mead_sampler.py --------- Co-authored-by: Yoshiaki Bando <yoshipon@users.noreply.github.com> * Add -e. (#371) * Support for suggest_int in neldermead sampler. (#373) * Support for suggest_int. * Fix for ruff. * Add Job dispatcher (#360) * Update aiaccel/job * fix lint error * fix aiaccel/job/dispatcher.py * wip * Fix issues pointed out in review * rename * fix test * fix for test * fix for test * fix for test * fix for test * Reflected code review feedback * fix test * fix test * refactoring * Run code formatter ruff * refactoring * Run code formatter ruff * fix lint.yaml * fix pypoject.toml * fix mypy.ini * fix mypy.ini * fix mypy.ini * fix mypy.ini * fix mypy.ini * Refactor abci jobs * Update pyproject.toml * adjusted to work in the ABCI environment. * fix lint error * fix test * fix test * Changed from unittest to pytest * Incorporate revisions based on review feedback * Add test items * fix test * fix test * fix test * remove __future__.annotations * A bit simplify qstat_xml * Simplify tests --------- Co-authored-by: Yoshiaki Bando <yoshipon@users.noreply.github.com> * Add ignore_missing_imports. (#376) * Draft Implementation of CLI Command (#369) * Update aiaccel/job * fix lint error * fix aiaccel/job/dispatcher.py * wip * Fix issues pointed out in review * rename * fix test * fix for test * fix for test * fix for test * fix for test * Reflected code review feedback * fix test * fix test * refactoring * Run code formatter ruff * refactoring * Run code formatter ruff * fix lint.yaml * fix pypoject.toml * fix mypy.ini * fix mypy.ini * fix mypy.ini * fix mypy.ini * fix mypy.ini * Refactor abci jobs * Update pyproject.toml * adjusted to work in the ABCI environment. * fix lint error * fix test * fix test * Changed from unittest to pytest * Incorporate revisions based on review feedback * Add test items * Add 'start.py' * Fix code format * update pyproject.toml * Remove unnecessary items from config * Add random seed option * Refactor examples/start.py into aiaccel/apps/optimize.py * fix lint errors and warnings * remove apps/config * fix typo * change config.yaml format * fix apps/optimizer * fix HparamManager __init__ * fix HparamsManager * Refactor Suggest class to use generics for improved type safety * auto fix by ruff * add optuna suggest wrapper * format fix * Update wrapper.py --------- Co-authored-by: Yoshiaki Bando <yoshipon@users.noreply.github.com> * Add nm docstring and move file (#381) * Add docstring. * Move nelder_mead_sampler.py. * Fix path. * Move test files. * autoformat and fix mypy error * Add v2 torch docstring (#384) * add docstring * Update abci_environment.py --------- Co-authored-by: Yoshiaki Bando <yoshipon@users.noreply.github.com> --------- Co-authored-by: KanaiYuma-aist <105629713+KanaiYuma-aist@users.noreply.github.com> Co-authored-by: Yoshiaki Bando <yoshipon@users.noreply.github.com> * fix confrict * Fixed consistency in revision history * Fixed consistency in revision history(2) --------- Co-authored-by: Yoshiaki Bando <yoshipon@users.noreply.github.com> Co-authored-by: Yoshiaki Bando <3883362-yoshipon@users.noreply.gitlab.com> Co-authored-by: KanaiYuma-aist <105629713+KanaiYuma-aist@users.noreply.github.com>
Nelder-Mead Sampler と、対応したテストを追加しました。
Nelder-Mead Sampler の仕様
基本的には現行aiaccelの_nelder_mead.py
をベースとしています。Vertex クラス、Store クラスは削除しました。テストについて
tests/unit_tests
直下に、アルゴリズムテストをtests/sampler/nelder_mead
直下にそれぞれ追加しました。optuna.study()
で探索を実行して、パラメータと計算結果を小数点以下第7位(assertAlmostEqual のデフォルト設定)まで一致しているかどうかを判定しています。