feat: 論文本番経路(W-Dist tune → 30ep×5seed → paper eval)と再現性基盤を公開正本として整備 - #66
Draft
koki3070 wants to merge 45 commits into
Draft
feat: 論文本番経路(W-Dist tune → 30ep×5seed → paper eval)と再現性基盤を公開正本として整備#66koki3070 wants to merge 45 commits into
koki3070 wants to merge 45 commits into
Conversation
run_backend_multiseed.py に loss.w_topo を上書きする任意 CLI を追加し、 topology ablation(w_topo=0 等)をマルチシード再現と同じ経路で実行可能にする。 Co-authored-by: Cursor <cursoragent@cursor.com>
- evaluate_paper_protocol.py: ellphi DBSCAN inference (MCC/G-Mean/W-Dist) with val-tuned eps/min_samples - evaluate_paper_baselines.py: Phase 3 baselines (Euclidean DBSCAN, IsolationForest, LOF, ADBSCAN) - aggregate_paper_results.py: build summary_for_paper.csv + MANIFEST.md - ellphi_postfix_autopipeline.sh: pilot -> fixed 12ep x 5seed main run (paper_reproduce_1week_tuned) - reproduce_ellphi_main.yaml: ellphi main config Migration of dxs0 work to dxs1. Co-authored-by: Cursor <cursoragent@cursor.com>
リファクタリング着手前に実験中の変更(configs 追加、losses/trainer 変更、 topo_wdist/teacher_pd/local_pca 等の新規モジュール、実験スクリプト群)を保全する。 Co-authored-by: Cursor <cursoragent@cursor.com>
- _rescale_distance_matrix の重複(losses.TopologicalLoss / topo_wdist)を distance_backend.rescale_distance_matrix に一本化 - サブサンプリングを subsample_indices として共通化 - compute_topo_distance_matrix / mahalanobis_distance_matrix_batched / normalize_topo_distance_mode / DISTANCE_MODE_* を losses から distance_backend へ移動(距離計算の責務を一箇所に) Co-authored-by: Cursor <cursoragent@cursor.com>
…_distance_matrix_np に改名 topology.compute_anisotropic_distance_matrix と動詞を統一し、NumPy を返す ラッパーであることを _np サフィックスで明示する。 Co-authored-by: Cursor <cursoragent@cursor.com>
- tda_ml/run_setup.py: デバイス解決・torch ランタイム設定・DataLoader 構築を main.py から移動(RNG 消費順序は不変) - tda_ml/model_selection.py: チェックポイント選択ポリシー(threshold_mcc / val_loss / val_topo / wdist / dbscan_mcc)を main.py のループから抽出 - trainer.py: 肥大化した __init__ を _init_amp / _init_losses に分割 - main.py は約 520 行 → 約 390 行に縮小、挙動は変更なし Co-authored-by: Cursor <cursoragent@cursor.com>
- tda_ml/preflight.py: tune/本番/paper eval の preflight ゲート(objective 種別を classify_tune_objective で判定し wdist/mcc 双方を受理) - tda_ml/reproducibility.py: strict 既定と失敗語彙(not-run / skipped / failed など)・fallback の manifest 記録 - tda_ml/run_paths.py: outputs/ 配下のパス規約 - configs/base.yaml: reproducibility.* の strict 既定 - 学習コア: power size 正則化・ellphi 教師 PD・val_topo 選択・manifest 拡充(main / trainer / losses / model_selection ほか) - tests: reproducibility strict / run_paths / dbscan grid wdist cache / barrier losses を追加、既存テスト更新
- run_status: preflight 失敗のみ not-run、学習中は running - checkpoint selection / manifest 既定を val_topo に統一 - classify_tune_objective: objective_kind 明示・ホワイトリスト・wdist 優先 - TopologicalLoss 非 strict skip を manifest に記録、未使用 dead code 削除 - REPRODUCIBILITY.md に preflight / reproducibility.* / run_status を追記 - base.yaml / dev.yaml に明示 loss 重みと selection 既定を追加 Co-authored-by: Cursor <cursoragent@cursor.com>
- third_party/ellphi.ref + scripts/ensure_ellphi_repo.sh を追加 - CI workflow で ensure 実行(pytorch-topological と同パターン) - pytest 用に CI の uv sync に --extra experiments を追加 - README / REPRODUCIBILITY.md / third_party/README.md を更新 Co-authored-by: Cursor <cursoragent@cursor.com>
train_main の戻り値 run_dir を使い、config_id プレフィックス glob を廃止。 CI repro smoke(mah_s42_* ディレクトリ)の検出失敗を修正。 Co-authored-by: Cursor <cursoragent@cursor.com>
- manifest/preflight に ellphi pin と installed SHA を記録、不一致は hard-fail - CI に ellphi grad API smoke を追加 - tests/test_ellphi_repo_pin.py、scripts/latest_run_dir.sh を追加 - 実験 shell / aggregate の legacy glob を eph_s42 対応 - README / REPRODUCIBILITY / third_party README を fork aware に更新 Co-authored-by: Cursor <cursoragent@cursor.com>
- チューニング: tune_elongate_wdist.py(val topo W-Dist 最小)/ tune_elongate_mcc.py(val DBSCAN MCC 最大・mahalanobis)と各起動シェル - 本番: run_teacher_local_pca_power_30ep.py(tune JSON の重み固定・30ep・val_topo ckpt・maha paper eval) - マルチシード: run_teacher_local_pca_power_30ep_multiseed.sh(paper seeds 42/123/456/789/1024、完了 seed は skip) - 集計: aggregate_power_30ep_multiseed.py → summary_proposed.csv(mean ± std) - eval: evaluate_paper_protocol.py / evaluate_paper_baselines.py を n100・maha 比較プロトコルに更新 - configs: 本番 base(elongate_n100_no_cls_full120_teacher_local_pca)と tune base(ellphi_power_mcc) - REPRODUCIBILITY.md: 論文比較で使う experiments/ の範囲と source_revision の注意を更新
- multiseed 集計の `|| true` を廃止し、MODE に応じた --methods で厳格に失敗させる - 本番 YAML に teacher_local_pca_normalize_axes: true を明示(tune base と一致) - infer_tag を tda_ml.preflight.classify_tune_objective に統一(未知 objective は hard-fail) - tune_elongate_wdist / evaluate_paper_baselines の --base-config を必須化(暗黙既定の排除) - REPRODUCIBILITY.md に重み固定プロトコル(seed 42 tune のみ・per-seed 再チューニングなし)を明記
- models: a_i = exp(Δa_i)*a_base(暗黙 sigmoid 有界化を revert) - main: train_epoch 例外時に run_status/final_status=failed を manifest へ記録 - REPRODUCIBILITY: axis_param 幽霊フラグ削除、clip なしと failed 語彙を明記 - multiseed: seed 並列 (N_WORKERS) と THREADS_PER_WORKER を doc 化 - test: exp(Δ)×base 写像の回帰テスト追加
軸投影や暗黙 fallback で退化を隠さず、訓練・評価・manifest・公開文書の W-Dist 契約を一致させる。 Co-authored-by: Cursor <cursoragent@cursor.com>
接線外れ値実験由来の中心 nudge を持ち込まず、中心一致を含む退化を一貫して hard-fail させる。 Co-authored-by: Cursor <cursoragent@cursor.com>
日付依存の旧 probe・ablation・運用パイプラインを除外し、no_cls 二目的チューニングと再現経路だけを公開対象として残す。 Co-authored-by: Cursor <cursoragent@cursor.com>
読者を混乱させる廃止済み損失項のコード・文書言及を残さず、現行の損失定義だけを公開面に残す。 Co-authored-by: Cursor <cursoragent@cursor.com>
本番経路を壊す objective whitelist 欠落と、H1-only 契約の黙認デフォルトを直し、旧 tune JSON を拒否して再チューニング必須を明示する。 Co-authored-by: Cursor <cursoragent@cursor.com>
欠落時の H0+H1 / prob_weighting / teacher / backend 黙認を禁止し、論文契約に ellphi+power を含め、本番は H1 tune JSON 必須・集計は欠落 seed で hard-fail する。 Co-authored-by: Cursor <cursoragent@cursor.com>
tune trial に paper contract を明示適用し、stale skip・duplicate seed・ size_* 非伝播・弱い preflight / stuck running を hard-fail で解消する。 Co-authored-by: Cursor <cursoragent@cursor.com>
fix: no_cls H1-only hard-fail 正本と公開面整理
MNIST の局所PCA接線方向に外れ値を置く異方性ノイズで再チューニング できるよう、学習・評価・manifest を貫通する配線を追加。 - run_setup / evaluate_paper_protocol: data.outlier_mode と tangent_* を NoisyMNISTDataset へ伝播。欠落は hard-fail(暗黙 uniform 禁止)。 - main: run_manifest に data_outliers(外れ値ジオメトリ)を記録。 - base.yaml: outlier_mode / noise_std を明示(既定 uniform / 0.01)。 - tangent_outliers: 宣言定数 MIN_TANGENT_OUTLIER_SEPARATION による 最小分離ガードを追加。同一元点+同方向から生成される外れ値が ほぼ完全一致すると ellphi の中心微分が未定義になるため、近接候補 は棄却・再試行し、達成不能なら hard-fail(退化を黙って潰さない)。 - 接線 tune config は noise_std=0.01(一様ベースラインと同一の インライアjitter=外れ値分布のみが差の公正比較、かつ量子化由来の 重複点を回避)。 - multi-fidelity ドライバ/ランチャ(接線版)を追加。
数値的に失敗したrefinement候補を黙って再利用せず、次順位のproxy候補を既存studyへ明示的に追加できるようにする。選択順位とappend操作をpreflight manifestへ記録し、回復経路を監査可能にする。
接線方向外れ値(local_pca_tangent)で本番30ep再学習するためのH1-only full120 config。uniform版と同一スタック(local_pca teacher + ellphi + power size, W-Dist)で、data.outlier_modeのみ接線に切替。production重みは 接線tune best JSON(--tune-json)から適用する前提。
MNISTの前景不足時に重複パディング+独立ノイズで中心が潰れると、 ellphiの mu 微分が数値的にゼロになり seed 789 などで学習が落ちる。 inlierノイズ適用とuniform外れ値にも最小分離を強制し、定数をmanifestへ記録する。
metrics側の明示topo_options必須化(hard-fail)にbaselineスクリプトが未対応で 接線データのADBSCANグリッド探索が落ちていた。val選択はMCCのみ(W-Distは eps/min_samplesに非依存)なのでNaNプレースホルダとし、test集計のみ実W-Distを config由来のTopoWdistOptionsで計算する。gitignoreはsymlink形態の pytorch-topologicalも無視するよう修正(worktreeのdirty誤判定防止)。
純接線変位は筆画に沿って移動するため外れ値の過半が筆画上に着地し、 ラベルと幾何が矛盾していた(外れ値→最寄りinlier中央値0.048 < inlier間隔0.064)。 接線±30°のコーンで方向を散らし、全clean inlierから0.08以上のsemantic クリアランスを棄却再抽選で保証する。jitter=0はRNG消費なしで旧接線モードと バイト一致。既存tangent configには旧挙動を明示する0.0を追記し、 tune/full120のneartangent configを新設。データ・manifest配線と検証つき。
新規study.dbへの並列create_study(load_if_exists=True)がalembicスキーマ移行で
競合し("table alembic_version already exists")、負けたワーカーが起動直後に
死んで総trial数が黙って不足する。ワーカー起動前に単独プロセスでstudyを
初期化する。
復旧用フラグなのに既存ディレクトリでFileExistsErrorになり追加投入できなかった。 append時はrank範囲付きの別名REFINEMENT_PREFLIGHTを書き、初回分を上書きしない。
near-tangentデータで素のelongateが短軸を~1e-5(アスペクト比~350)まで潰し、 ellphi tangencyがhard-failしてstage-2 tune 16条件中15条件が死んだ。対策として elongate報酬+閾値超過アスペクト比への二次バリアのvariantを明示宣言式で導入: - PAPER_NO_CLS_BARRIER_CONTRACT(aniso_barrier_threshold=6.0必須)を宣言し、 assert_paper_no_cls_contractはloss.aniso_mode宣言でvariantを選択 - paper_aniso_fields()でbase configの宣言をtune/本番overridesへ伝播 (従来の'elongate'ハードコードを廃止、非契約modeはhard-fail) - trainer/preflightはbarrier系modeでaniso_barrier_threshold未指定をhard-fail (暗黙の6.0デフォルト禁止) - 30ep本番はaniso_barrier_thresholdをRUN_PLAN/manifestのloss_overridesに記録、 paper評価はloss_overridesからbarrier閾値を復元 - aggregate_power_30ep_multiseedに--aniso-variantを追加し契約一致を検証 - near-tangent barrier用のtune/full120 configを追加 - barrier勾配の退化回復テスト、契約variantテスト、tune配線テストを追加
near-tangentでは外れ値が楕円長軸上に乗り異方性距離に吸収される (提案・ADBSCANともrecall~0.48)ため、異方性仮説を正しく検証する 短軸方向(ストローク横断)配置をtangent_directionとして明示配線。 既存configにはtangent_direction: tangentを明示追加(暗黙デフォルト排除)。
MNIST雲では教師楕円のアスペクト比が~1.8しかなくノイズ方向の設計が 効かないため、異方性仮説が構造的に検証可能な最小構成として ThinRingsDataset(教師アスペクト~8、半径方向外れ値はユークリッド 曖昧・マハラノビス明瞭、H1ループ)を追加。data.dataset_typeを run_setup/main(manifest)/evaluate_paper_protocolに明示必須で配線。
ADBSCANは観測雲のlocal PCAを使うため近傍汚染に弱い一方、提案はclean 教師で学ぶ。汚染率~98%まで上げて帰納バイアスの勝ち筋を検証する。
- 探索系config/実験スクリプト(tangent/rings/multifidelity等)を公開面から削除 - paper eval を best_model.pth(val_topo)専用化し strict=True で部分読込を禁止 - tuneベースYAMLを objective 中立名(..._ellphi_power)へ改名 - topo_wdist/preflight/run_setup の暗黙デフォルトを hard-fail 化 - fallback opt-in を reproducibility.* 単一経路に統一、ZERO_PAD_ABS_SUM をmanifest記録 - ADBSCAN局所PCAを tda_ml.local_pca に共通化、dead code(model_inference等)削除 - README/REPRODUCIBILITY を主表主張(記述的比較・学習有無の非対称明記)に更新
MCC並列tuneのOptunaスキーマ競合、学習/evalのdata root不一致、 paper evalのreproducibilityフラグ未伝播、NaNプレースホルダ集計を解消し、 公開文書のMethods variant位置づけを明確化する。 Co-authored-by: Cursor <cursoragent@cursor.com>
elongate/full120 など誤解を招く接頭辞をやめ、 paper_/tune_ + n100_o20_nocls_h1_ellphi_lpca_power に統一。 未使用の baseline と Methods-only barrier YAML は公開面から削除。 Co-authored-by: Cursor <cursoragent@cursor.com>
tune_elongate_* / run_teacher_local_pca_power_* 等を tune_wdist / run_paper_30ep / eval_paper 等へ改名。 出力パス・eval タグ・run_slug も paper/tune 語彙に揃える。 Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
- paper_n100_o20_nocls_* と tune_n100_o20_nocls_* が同一 slug
(h1_ellphi_lpca_power) に潰れ、run ディレクトリ名から config を
特定できなくなっていた。role トークンを残すよう変更。
- 旧 config_id teacher_local_pca_power_seed{N} を paper_s{N} に
再割当てしていたため、正本 paper_seed{N} と run 名前空間が衝突。
ディスク上の実ディレクトリ名 pwr_s{N} に戻して分離を回復。
- prefix 除去も origin/main と同一挙動に戻し、旧 slug を維持。
Co-authored-by: Cursor <cursoragent@cursor.com>
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
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.
概要
upstream
main(#64 マージ後)の上に、論文主表の本番経路一式と再現性基盤を公開正本として追加します(コンフリクトなし)。計算再現性の規律は computational-reproducibility skill に準拠します。
主な内容
論文本番経路(主表)
experiments/tune_objectives.sh/run_paper_30ep_multiseed.sh/eval_paper.py/eval_baselines.pypaper_n100_o20_nocls_h1_ellphi_lpca_power/tune_n100_o20_nocls_h1_ellphi_lpca_powerbest_model.pth(val_topo)専用再現性基盤
default_data_root()third_party/ellphi.ref)と CI smoke公開面の整理
elongate_*/teacher_local_pca_power_*を廃止)Test plan
uv run pytest/uv run ruff check .assert_paper_no_cls_contractを通過備考