-
Notifications
You must be signed in to change notification settings - Fork 4
First commit to add modelbridge module and its test. #515
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
Draft
tkokada
wants to merge
12
commits into
main
Choose a base branch
from
feature/modelbridge
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Collaborator
Author
feature/modelbridge 変更サマリ (2025-11-16)1. 背景
2. 主要変更点
3. 残確認事項
|
Collaborator
Author
72809d9 以降の変更サマリ(feature/modelbridge)
File/Feature Quick Reference
|
Collaborator
Author
変更サマリー (8209d6d..HEAD)前回のコミット (8209d6d) からの主な変更点は以下の通りです。 1. Modelbridge コアの大規模リファクタリング複雑化していたクラス構成を廃止し、関数ベースのパイプライン処理へ移行しました。これによりコードの見通しと保守性を向上させています。
2. データ同化 (Data Assimilation) 機能の追加と整理データ同化に関する実験環境を実装・整備しました。
3. サンプル・ベンチマークコードの再構成
4. その他
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
feature/modelbridge Update Guide
このドキュメントは
feature/modelbridgeブランチで導入したモデルブリッジ設計の概要とレビュー時に押さえるべきポイントをまとめたものです。1. 全体像と目的
2. 主要モジュールと役割
aiaccel/hpo/modelbridgeapp.py:aiaccel-hpo modelbridgeの CLI エントリ。設定を Omegaconf 経由で読み込み、run_pipelineを呼び出します。config.py: 再設計仕様で定義した dataclass 群とload_bridge_configによる型付きバリデーション。マクロ/ミクロ両方のパラメータ空間を区別して管理します。runner.py: 実行フローの中心。マクロ・ミクロ各フェーズのトライアル実行、サンプル構築、回帰の学習・評価・成果物出力をまとめています。optimizers.py: Optuna を用いた最適化フェーズ実行(マクロ、ミクロ共通)。TrialContextに統一情報を詰めてevaluators.pyの Strategy へ渡します。evaluators.py: 設定から評価関数を動的ロードするための薄いラッパ。Python callable / 外部コマンドの両方をサポートします。regression.py: マクロ→ミクロを多出力線形モデルとして表現。RegressionSampleから NumPy の最小二乗で係数を推定し、predictions.csvに出力できる dict 形式の予測を返します。io.py,summary.py,logging.py,types.py: 結果ファイルの書き出し、サマリ集計、ロギング補助といった共通処理をコンパクトに提供します。exceptions.py: 設計上の不正状態(設定不備、評価失敗など)を表す独自例外。examples/hpo/modelbridgesimple_benchmark.py: 単一シナリオ(平滑な二変数関数)を使った極小例。マクロとミクロが同じ関数空間を探索し、回帰モデルを通じた推論・比較まで一周させます。multi_function_benchmark.py:modelbridge-ccの Simple Benchmark を着想源に、Sphere / Rastrigin / Griewank 間の橋渡しを複数シナリオで行います。SCENARIOS定義により各ケースのマクロ・ミクロ関数や回帰設定、トライアル数を切り替えています。3. 既存 aiaccel との関係
aiaccel/launcher.pyがaiaccel.hpo.modelbridge.appを呼び出すため、既存のaiaccel-hpo <subcommand>流儀と整合します。aiaccel.configのload_config,resolve_inherit,print_configをそのまま利用し、既存プロジェクトと同じ Config パターンでモデルブリッジを設定できます。4. 新機能・挙動の要点
RegressionSample(features=macro_params, target=micro_params)を生成。NumPy の最小二乗で複数パラメータを一度に回帰します。regression.jsonに学習済みパラメータを保存し、predictions.csvに実測値と推論値を併記。summary.jsonにはシナリオごとの試行回数・ベストパラメータ・評価値を集約します。BridgeSettings.seedでマクロ・ミクロ両フェーズの乱数を固定。run_pipelineが設定されたシードをフェーズ毎に使い分けている点も確認済みです。5. テストと検証
tests/hpo/test_modelbridge/に新たに軽量テストを整備。test_config.py: 設定のバリデーション挙動を検証。test_evaluators.py: Python callable とコマンド評価の双方が利用できることを確認。test_optimizers.py: Optuna フェーズの実行結果と最良パラメータ取得をチェック。test_regression.py: 多出力回帰の学習/不正入力時の例外を確認。test_runner.py: パイプラインの成果物(summary, trials, predictions)生成を一通り確認。6. サンプル実行方法
simple_benchmark
work/modelbridge/simple/配下にsummary.json,scenarios/simple/...が生成されます。predictions.csvで対比。multi_function_benchmark
work/modelbridge/multi_function/配下に、各シナリオ(sphere_to_rastriginなど)の成果物ディレクトリが作成されます。predictions.csvで比較が可能です。