From 696a7ab6e7760319eb2d709e4e547668dfbefc80 Mon Sep 17 00:00:00 2001 From: Felix Rios Date: Wed, 7 Feb 2024 13:51:28 +0100 Subject: [PATCH 1/3] Missing context score bugg should be fixed. --- VERSION | 2 +- src/cstrees/learning.py | 3 ++- src/cstrees/scoring.py | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index 8cfbc90..8428158 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.1.1 \ No newline at end of file +1.1.2 \ No newline at end of file diff --git a/src/cstrees/learning.py b/src/cstrees/learning.py index 5f719f2..779ecf7 100644 --- a/src/cstrees/learning.py +++ b/src/cstrees/learning.py @@ -150,7 +150,8 @@ def _optimal_staging_at_level(order, context_scores, level, max_cvars=2, poss_cv # here we (=I) anyway extract just the context, so the stage format is a bit redundant. stage_context = sc._stage_to_context_key(stage, order) - score = context_scores["scores"][var][stage_context] + if stage_context in context_scores["scores"][var]: + score = context_scores["scores"][var][stage_context] staging_score += score # Update the max score and the max staging diff --git a/src/cstrees/scoring.py b/src/cstrees/scoring.py index 2913a32..e558ce7 100644 --- a/src/cstrees/scoring.py +++ b/src/cstrees/scoring.py @@ -490,7 +490,8 @@ def order_score_tables(data: pd.DataFrame, for stage in staging: # OK! even when restricting to some possible cvars stage_context = _stage_to_context_key(stage, subset) - staging_unnorm_post += context_scores["scores"][var][stage_context] + if stage_context in context_scores["scores"][var]: + staging_unnorm_post += context_scores["scores"][var][stage_context] if i == 0: order_scores["scores"][var][subset_str] = staging_unnorm_post From 6ba9253a55744dd10eeabcab93ac30531f846a60 Mon Sep 17 00:00:00 2001 From: Felix Rios Date: Tue, 13 Feb 2024 09:05:30 +0100 Subject: [PATCH 2/3] Added reference to arxiv paper. --- README.rst | 2 +- docs/_static/bibtex.bib | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index f2df90e..9712611 100644 --- a/README.rst +++ b/README.rst @@ -12,7 +12,7 @@ -This is a Python package for CStree models :footcite:p:`duarte2021representation`, a family of graphical causal models that encode context-specific dependence for multivariate multinomial distributions. +This is a Python package for CStree models :footcite:p:`duarte2021representation` :footcite:p:`rios2024scalable` a family of graphical causal models that encode context-specific dependence for multivariate multinomial distributions. .. As not all staged tree models admit this property, CStrees are a subclass that provides a transparent, intuitive and compact representation of context-specific causal information. diff --git a/docs/_static/bibtex.bib b/docs/_static/bibtex.bib index 1fda854..07bcc0b 100644 --- a/docs/_static/bibtex.bib +++ b/docs/_static/bibtex.bib @@ -5,3 +5,13 @@ @article{duarte2021representation year={2021}, url={https://arxiv.org/abs/2101.09271} } + +@misc{rios2024scalable, + title={Scalable Structure Learning for Sparse Context-Specific Causal Systems}, + author={Felix L. Rios and Alex Markham and Liam Solus}, + year={2024}, + eprint={2402.07762}, + archivePrefix={arXiv}, + primaryClass={stat.ML}, + url={https://arxiv.org/abs/2402.07762} +} \ No newline at end of file From 1a6ba6ff1bcfd6af6897d78ac2245df0cfe86cb1 Mon Sep 17 00:00:00 2001 From: Felix Rios Date: Tue, 13 Feb 2024 09:09:13 +0100 Subject: [PATCH 3/3] Added reference to arxiv paper. --- docs/_static/bibtex.bib | 10 +++++----- docs/source/learn_demo.ipynb | 2 +- src/cstrees/__meta__.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/_static/bibtex.bib b/docs/_static/bibtex.bib index 07bcc0b..a687d8b 100644 --- a/docs/_static/bibtex.bib +++ b/docs/_static/bibtex.bib @@ -1,9 +1,10 @@ -@article{duarte2021representation, +@misc{duarte2021representation, title={Representation of context-specific causal models with observational and interventional data}, author={Duarte, Eliana and Solus, Liam}, - journal={arXiv preprint arXiv:2101.09271}, + archivePrefix={arXiv}, year={2021}, - url={https://arxiv.org/abs/2101.09271} + primaryClass={stat.ML}, + eprint={2101.09271} } @misc{rios2024scalable, @@ -12,6 +13,5 @@ @misc{rios2024scalable year={2024}, eprint={2402.07762}, archivePrefix={arXiv}, - primaryClass={stat.ML}, - url={https://arxiv.org/abs/2402.07762} + primaryClass={stat.ML} } \ No newline at end of file diff --git a/docs/source/learn_demo.ipynb b/docs/source/learn_demo.ipynb index 5d6eb58..ddf22c5 100644 --- a/docs/source/learn_demo.ipynb +++ b/docs/source/learn_demo.ipynb @@ -12,7 +12,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "This notebook shows how to learn a CStree from observational data using an exhaustive search. procedure. " + "This notebook shows how to learn a CStree from observational data using an exhaustive search procedure. " ] }, { diff --git a/src/cstrees/__meta__.py b/src/cstrees/__meta__.py index 6bd7bb5..c16fa39 100644 --- a/src/cstrees/__meta__.py +++ b/src/cstrees/__meta__.py @@ -1,3 +1,3 @@ # Automatically created. Please do not edit. -__version__ = '1.1.1' +__version__ = '1.1.2' __author__ = ''