Skip to content

Add DGES algorithm and enhance GES with updated BIC score and colored graph visualization#256

Merged
kunwuz merged 2 commits intopy-why:mainfrom
lokali:dges-implementation
Mar 27, 2026
Merged

Add DGES algorithm and enhance GES with updated BIC score and colored graph visualization#256
kunwuz merged 2 commits intopy-why:mainfrom
lokali:dges-implementation

Conversation

@lokali
Copy link
Copy Markdown

@lokali lokali commented Mar 25, 2026

  • Add DGES (Deterministic GES): Algorithm 1 from Li et al. (NeurIPS 2024) for causal discovery in the presence of deterministic relations. Three-phase approach: MinDC detection, DC-aware GES, optional exact search.
  • Add deterministic-aware BIC score (local_score_BIC_from_cov_deterministic) that handles zero residual variance gracefully.
  • Add covariance-based BIC score (local_score_BIC_from_cov) for GES, enabling GES to run from precomputed covariance matrices.
  • Add lambda_value parameter to GES for controlling BIC penalty strength.
  • Add node_names parameter to GES for custom node labeling.
  • Add GraphUtils.plot_graph() for rendering colored causal graphs with manual per-node colors or automatic category-based coloring.
  • Add GraphUtils.get_category_colors() helper for category-to-color mapping.
  • Update documentation: DGES page, enhanced GES page, Datasets page, Graph Visualization page under Utilities.

@MarkDana MarkDana requested review from MarkDana and kunwuz March 25, 2026 18:16
Comment thread causallearn/utils/ScoreUtils.py
@MarkDana
Copy link
Copy Markdown
Collaborator

Thank you so much @lokali for the efforts. Wonderful job in 1) resolving previous issues on lambda penalty term, 2) speedup >5x, and many more!

I have met with Loka offline and checked the code part; it looks good to me, except for a quick question above on the kernel based score.

@kunwuz could you please then review the readthedocs html part, and see if they render properly? If so I think this pr is ready to be merged.

Loka thank you again!

@kunwuz
Copy link
Copy Markdown
Collaborator

kunwuz commented Mar 26, 2026

Thanks for the PR and review! The doc part is a bit different--we previously only edited/added rst files like docs/source/search_methods_index/Score-based causal discovery methods/GES.rst, and building html is done online via readthedocs. Could you please remove the html files here, and open a new pr with new rst files similar to the one pointed above?

Code changes:
- Add DGES (Deterministic GES): Algorithm 1 from Li et al. (NeurIPS 2024)
  for causal discovery in the presence of deterministic relations.
- Add deterministic-aware BIC score (local_score_BIC_from_cov_deterministic).
- Add covariance-based BIC score (local_score_BIC_from_cov) for GES.
- Add lambda_value top-level parameter to GES for BIC penalty control.
- Add node_names parameter to GES for custom node labeling.
- Add GraphUtils.plot_graph() for colored graph visualization.
- Add GraphUtils.get_category_colors() for category-to-color mapping.
- Set default BIC lambda_value=0.5 (standard BIC: 0.5*log(n) per param).
- Fix gpr_multi_new gradient: only optimize noise variance per paper
  (Huang et al., 2018, Sec 4.2.2: kernel widths are fixed).

Documentation (RST for ReadTheDocs):
- Add DGES.rst under Score-based causal discovery methods.
- Add GraphVisualization.rst under Utilities.
- Update index.rst files to include new pages.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@lokali lokali force-pushed the dges-implementation branch from eb7625e to 5d5e849 Compare March 26, 2026 19:08
@lokali
Copy link
Copy Markdown
Author

lokali commented Mar 26, 2026

@MarkDana @kunwuz Thanks for your reply! I have update the code in rst, and removed those in html. Please kindly review it!

The score functions were unified to return higher-is-better scores,
but GST (used by GRaSP and BOSS) was negating the scores internally,
causing these algorithms to produce near-complete graphs. Remove the
negation so GST correctly uses the scores directly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kunwuz kunwuz merged commit b8a1488 into py-why:main Mar 27, 2026
2 checks 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.

3 participants