Skip to content

Beast3 - #18

Open
walterxie wants to merge 8 commits into
masterfrom
beast3
Open

Beast3#18
walterxie wants to merge 8 commits into
masterfrom
beast3

Conversation

@walterxie

Copy link
Copy Markdown

Summary

Migrates nested-sampling from BEAST2 (2.7.x) / Ant to BEAST3 (2.8.0-beta7) / Maven. Tracked in #16. It now depends on model-selection:1.7.0-beta1.

Build system: Ant → Maven

  • Replaced build.xml with pom.xml (Java 25 release target).
  • Reorganized source tree into standard Maven layout (src/main/java, src/main/resources, src/test/java, src/test/resources).
  • Added module-info.java (JPMS), requiring beast.base, model.selection, org.apache.commons.statistics.distribution, and org.apache.commons.math4.core, with optional BEAST FX/JavaFX for the GUI.
  • Added .github/workflows/ci-publish.yml, src/assembly/beast-package.xml.
  • Bumped version.xml to 1.3.0, depending on BEAST.base/BEAST.app >=2.8.0 and MODEL_SELECTION >=1.7.0.

Parameter → Tensor

Same BEAST3 type-system change as in model-selection. In NS.java, NIS.java, and NSOperatorSchedule.java, instanceof Parameter checks and Parameter.getDimension() calls became instanceof Tensor / Tensor.size() — StateNode dimension-counting logic is otherwise unchanged.

Commons Math → Commons Statistics / Commons Math 4

Two distinct replacements were needed, since BEAST3 dropped org.apache.commons.math entirely:

  • NSLogAnalyser: BetaDistribution/BetaDistributionImpl → org.apache.commons.statistics.distribution.BetaDistribution (same pattern as model-selection).
  • YuleModelNormalised: org.apache.commons.math3.util.FastMathorg.apache.commons.math4.core.jdkmath.AccurateMath — per the commons-math 4.0-beta1 changelog this is a straight s part of the legacy-module reorg, so behavior isunchanged; documented inline with a comment explaining why.

JUnit 4 → 5

All test classes use org.junit.jupiter.api.Test/Assertions; pom.xml adds junit-jupiter as a test dependency.

Test infrastructure duplicated to make the build compile

BEASTTestCase, XMLPathUtil, and ExampleXmlParsingTest (under src/test/java/test/beast/) were copied into this project's own test
sources rather than reused from beast-base, because s aren't published as a reusable test-jar artifact in the new modular Maven setup — duplicating them was the only way to get mvn test to compile.

YuleModelNormalised: moved main to a proper unit test

The original class had a public static void main(...) used only for manual smoke-testing, which pulled in a dependency on
BEASTTestCase inside the main sources. That method woved to a newYuleModelNormalisedTest.testYuleModelNormalised(). Since there was no previously-recorded expected value to migrate, the expected
logP (-10.018014963613476) was generated by running ST3 code itself — the test comment notes thisexplicitly ("computed from beast3 code on July 2026"), so it's a regression-guard baseline rather than an independently verified
value.

NS_4taxa_NormalBirthRate.xml: init issue, expected value diverges

Running the migrated XML under BEAST3 threw an initialization error from the RandomTree, fixed by adding rootHeight="0.19" to force a valid starting height. However, this changes the initial state enough that the nested-sampling evidence estimate Z no longer matches the original BEAST2 expected value:

  • original expected: Z = -2349.5333124902536
  • actual under BEAST3 (with the rootHeight fix): Z = -2359.7856198890186

Maven release beta1 is https://central.sonatype.com/artifact/io.github.beast2-dev/nested-sampling


TODO:

@walterxie
walterxie requested review from alexeid and rbouckaert July 28, 2026 04:29
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.

1 participant