Skip to content

fix: issue #59 — ad-hoc 微小正定数の整理と論文外モデリング床の削除 - #62

Merged
t-uda merged 2 commits into
uda-lab:mainfrom
koki3070:fix/issue59-numerical-eps
Jun 21, 2026
Merged

fix: issue #59 — ad-hoc 微小正定数の整理と論文外モデリング床の削除#62
t-uda merged 2 commits into
uda-lab:mainfrom
koki3070:fix/issue59-numerical-eps

Conversation

@koki3070

Copy link
Copy Markdown
Contributor

Summary

Closes #59.

PR #54#58 マージ後の follow-up として、教師あり本線 tda_ml/ の ad-hoc 微小正定数を棚卸しし、論文に無いモデリング床を削除しました。再検証で見つかった sqrt(0) 勾配爆発(AMP 下で学習停止)も修正しています。

  • 削除: encoder clamp(base_axes, min=0.2)、legacy axes + 1e-4、metric への軸長 +1e-6
  • 集約: tda_ml/numerical_eps.pyNUMERICAL_EPS, PCA_RIDGE_EPS, EIGENVALUE_FLOOR, INLIER_PROB_MIN
  • 修正: sqrt(dist_sq + NUMERICAL_EPS)(対角の勾配有限化;宣言的 L2 床)
  • 厳格化: TopologicalLoss がバッチ全件失敗時に黙って 0 を返さず RuntimeError

Verification

mahalanobis 12ep(configs/issue59_verify_mahalanobis.yaml, seed=42, reproduce_1week_tuned 相当):

指標
best val_mcc 0.7640
test_mcc 0.751
run outputs/issue59_verify_mahalanobis_20260617_090007

詳細は issue コメント を参照。

Test plan

  • pytest tests/test_topology.py tests/test_topology_gradients.py
  • test_legacy_axes_positive_without_modeling_floor
  • 教師あり 12ep mahalanobis 再検証(上記)

Out of scope (follow-up)

  • 退化ケースの明示分岐設計
  • rk_tanh / hybrid_rk_tanh 等の軸パラメータ拡張
  • 教師あり本線外(reproduce_pd_animation.py 等)の定数棚卸し

Made with Cursor

数値安定化定数を numerical_eps.py に集約し、encoder clamp(0.2) と legacy +1e-4 を削除。
sqrt(0) 勾配爆発を sqrt(dist_sq + NUMERICAL_EPS) で修正し、TopologicalLoss の全バッチ失敗を RuntimeError にする。

Closes uda-lab#59

Co-authored-by: Cursor <cursoragent@cursor.com>
@t-uda

t-uda commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

@codex review this PR

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bbac84cf29

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tda_ml/topology.py
Comment thread REPRODUCIBILITY.md
Comment thread REPRODUCIBILITY.md
Codex 指摘のドキュメント/実装不一致を解消。early_abort・診断を main に統合し
REPRODUCIBILITY.md が案内する experiments/issue59_verify_mahalanobis.py を追加。

Co-authored-by: Cursor <cursoragent@cursor.com>
@koki3070

Copy link
Copy Markdown
Contributor Author

レビュー指摘への対応(82f9528

Codex P2 — REPRODUCIBILITY.md / legacy +1e-4(対応済み)

  • AnisotropicOutlierClassifier.forwardaxes = axes_scale * base_axes + 1e-4 を削除し、axes = axes_scale * base_axes に統一
  • コミットメッセージ・REPRODUCIBILITY.mdtest_legacy_axes_positive_without_modeling_floor の記述と実装を一致

Codex P2 — experiments/issue59_verify_mahalanobis.py 欠落(対応済み)

  • experiments/issue59_verify_mahalanobis.py を追加(configs/issue59_verify_mahalanobis.yaml を読み、preflight 後に tda_ml.main を実行)
  • tda_ml/supervised_diagnostics.pytda_ml/main.pyearly_abort / run_manifest.json / abort レポート出力を統合
  • configs/issue59_verify_mahalanobis.yamlearly_abort.enabled: trueprobe_epochs: 8
  • tests/test_supervised_diagnostics.py 追加
  • REPRODUCIBILITY.md のリポジトリ範囲・probe_epochs 説明を更新

Codex P2 — tda_ml/topology.py の clamp 復帰提案(対応なし)

  • t-uda さんコメント「却下.不要な clamp」に従い、sqrt(dist_sq + NUMERICAL_EPS) のまま変更していません

検証

  • uv run pytest パス
  • CI(Ruff workflow: ruff + pytest + repro-smoke)パス

@t-uda t-uda left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@t-uda
t-uda merged commit 63498a3 into uda-lab:main Jun 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Follow-up: 正則化・安定化のための ad-hoc 微小正定数の要否をPR 54〜58 マージ後に再検証する

2 participants