From deccc8972e9d271286ef1a564df8be0eeec2a1e4 Mon Sep 17 00:00:00 2001 From: Roman Ludwig <48687784+rmnldwg@users.noreply.github.com> Date: Mon, 29 Sep 2025 15:50:18 +0200 Subject: [PATCH 1/3] chore: change email addresses --- pyproject.toml | 4 +++- src/lyscripts/__init__.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1f095be..75401c0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,9 @@ build-backend = "setuptools.build_meta" name = "lyscripts" description = "Package to interact with lymphatic progression data and models." authors = [ - {name = "Roman Ludwig", email = "roman.ludwig@usz.ch"} + {name = "Roman Ludwig", email = "gygqdstu3@mozmail.com"}, + {name = "Yoel Pérez Haas", email = "yoel.perezhaas@usz.ch"}, + {name = "Noemi Bührer", email = "noemi.buehrer@usz.ch"}, ] readme = "README.md" requires-python = ">=3.10" diff --git a/src/lyscripts/__init__.py b/src/lyscripts/__init__.py index e9dbcb1..32808f2 100644 --- a/src/lyscripts/__init__.py +++ b/src/lyscripts/__init__.py @@ -25,7 +25,7 @@ __version__ = version __description__ = "Package to interact with lymphatic progression data and models." __author__ = "Roman Ludwig" -__email__ = "roman.ludwig@usz.ch" +__email__ = "gygqdstu3@mozmail.com" __uri__ = "https://github.com/lycosystem/lyscripts" # activate copy on write in pandas. From c96615b8f18b6da5f8d8e2c92f6819f04fdea77a Mon Sep 17 00:00:00 2001 From: noemibuehrer Date: Mon, 2 Mar 2026 11:15:43 +0100 Subject: [PATCH 2/3] fix: correct TI evaluation and leave out uncertainty reporting --- src/lyscripts/compute/evidence.py | 25 +++++++++---------------- src/lyscripts/evaluate.py | 25 +++++++++---------------- 2 files changed, 18 insertions(+), 32 deletions(-) diff --git a/src/lyscripts/compute/evidence.py b/src/lyscripts/compute/evidence.py index 1cd51e2..ffce481 100644 --- a/src/lyscripts/compute/evidence.py +++ b/src/lyscripts/compute/evidence.py @@ -48,23 +48,17 @@ def comp_bic(log_probs: np.ndarray, num_params: int, num_data: int) -> float: def compute_evidence( temp_schedule: np.ndarray, log_probs: np.ndarray, - num: int = 1000, -) -> tuple[float, float]: - """Compute the evidence and its standard deviation. +) -> float: + """Compute the evidence. Given a ``temp_schedule`` of inverse temperatures and corresponding sets of - ``log_probs``, draw ``num`` "paths" of log-probabilities and compute the evidence - for each using trapezoidal integration. - - The evidence is then the mean of those ``num`` integrations, while the error is - their standard deviation. + ``log_probs``, we calculate the mean ``log_prob`` over all samples to approximate + the expectation value under the corresponding power posterior for each step in the + ``temp_schedule``. The evidence is evaluated using trapezoidal integration of the + expectation values over the ``temp_schedule``. """ - integrals = np.zeros(shape=num) - for i in range(num): - rand_idx = RNG.choice(log_probs.shape[1], size=log_probs.shape[0]) - drawn_accuracy = log_probs[np.arange(log_probs.shape[0]), rand_idx].copy() - integrals[i] = trapezoid(y=drawn_accuracy, x=temp_schedule) - return np.mean(integrals), np.std(integrals) + a_mc = np.mean(log_probs, axis=1) + return trapezoid(y=a_mc, x=temp_schedule) def compute_ti_results( @@ -95,9 +89,8 @@ def compute_ti_results( ) ti_log_probs[i] = reader.get_blobs(flat=True)["log_prob"] - evidence, evidence_std = compute_evidence(temp_schedule, ti_log_probs) + evidence = compute_evidence(temp_schedule, ti_log_probs) metrics["evidence"] = evidence - metrics["evidence_std"] = evidence_std return temp_schedule, ti_log_probs diff --git a/src/lyscripts/evaluate.py b/src/lyscripts/evaluate.py index d09c5dd..5f9dbd0 100644 --- a/src/lyscripts/evaluate.py +++ b/src/lyscripts/evaluate.py @@ -90,23 +90,17 @@ def comp_bic(log_probs: np.ndarray, num_params: int, num_data: int) -> float: def compute_evidence( temp_schedule: np.ndarray, log_probs: np.ndarray, - num: int = 1000, -) -> tuple[float, float]: - """Compute the evidence and its standard deviation. +) -> float: + """Compute the evidence. Given a ``temp_schedule`` of inverse temperatures and corresponding sets of - ``log_probs``, draw ``num`` "paths" of log-probabilities and compute the evidence - for each using trapezoidal integration. - - The evidence is then the mean of those ``num`` integrations, while the error is - their standard deviation. + ``log_probs``, we calculate the mean ``log_prob`` over all samples to approximate + the expectation value under the corresponding power posterior for each step in the + ``temp_schedule``. The evidence is evaluated using trapezoidal integration of the + expectation values over the ``temp_schedule``. """ - integrals = np.zeros(shape=num) - for i in range(num): - rand_idx = RNG.choice(log_probs.shape[1], size=log_probs.shape[0]) - drawn_accuracy = log_probs[np.arange(log_probs.shape[0]), rand_idx].copy() - integrals[i] = trapezoid(y=drawn_accuracy, x=temp_schedule) - return np.mean(integrals), np.std(integrals) + a_mc = np.mean(log_probs, axis=1) + return trapezoid(y=a_mc, x=temp_schedule) def compute_ti_results( @@ -134,9 +128,8 @@ def compute_ti_results( reader = emcee.backends.HDFBackend(model, name=f"ti/{run}", read_only=True) ti_log_probs[i] = reader.get_blobs(flat=True) - evidence, evidence_std = compute_evidence(temp_schedule, ti_log_probs) + evidence = compute_evidence(temp_schedule, ti_log_probs) metrics["evidence"] = evidence - metrics["evidence_std"] = evidence_std return temp_schedule, ti_log_probs From d38f77c2c6fbc242b30330e5143ecdfd79f84e5c Mon Sep 17 00:00:00 2001 From: noemibuehrer Date: Wed, 8 Apr 2026 16:13:49 +0200 Subject: [PATCH 3/3] chore: update changelog --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5e5ef2..84abe31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to this project will be documented in this file. +## [1.0.2] - 2026-04-08 + +### Bug Fixes + +- Correct TI evaluation and leave out uncertainty reporting. Fixes [#81]. + +### Miscellaneous Tasks + +- Change email addresses. + ## [1.0.1] - 2025-09-10 ### Bug Fixes @@ -915,6 +925,7 @@ returns `None` instead. Fixes [#11] ## [0.5.3] - 2022-08-22 +[1.0.2]: https://github.com/lycosystem/lyscripts/compare/1.0.1...1.0.2 [1.0.1]: https://github.com/lycosystem/lyscripts/compare/1.0.0...1.0.1 [1.0.0]: https://github.com/lycosystem/lyscripts/compare/1.0.0rc3...1.0.0 [1.0.0rc3]: https://github.com/lycosystem/lyscripts/compare/1.0.0rc2...1.0.0rc3 @@ -979,6 +990,7 @@ returns `None` instead. Fixes [#11] [#72]: https://github.com/lycosystem/lyscripts/issues/72 [#74]: https://github.com/lycosystem/lyscripts/issues/74 [#75]: https://github.com/lycosystem/lyscripts/issues/75 +[#81]: https://github.com/lycosystem/lyscripts/issues/81 [`emcee`]: https://emcee.readthedocs.io/en/stable/ [`rich`]: https://rich.readthedocs.io/en/latest/