Tutorial: FBD example

This tutorial walks through the Fossilized Birth-Death (FBD) example in examples/FBD and shows how BELLA predicts skyline speciation and extinction rates.

How BELLA fits into BEAST

If you are new to BEAST, think of it this way:

  1. BEAST is a Bayesian engine that runs MCMC to estimate phylogenies and model parameters.
  2. BELLA is a package that provides a neural-network component (bella.BayesMLP) that BEAST can call inside the model.
  3. Your BEAST XML config file wires predictors -> BELLA network -> phylodynamic rates -> likelihood.

In short: BELLA is a neural network node inside the BEAST model graph 🧠➡️🌳.

What you need to know before you start

Ready? Head to the installation guide next! 🚀

Files you will use

Step 1: Review the JSON parameters

Open examples/FBD/data.json and check these values:

Important rule: the number of predictor values must equal length(changeTimes) + 1.

Step 2: See how BELLA is used in the XML

Inside config.xml, BELLA is used twice - once for birth rates and once for death rates. Both are skyline parameters with the same time bins:

<birthRate id="birthRateSP" spec="SkylineVectorParameter" changeTimes="$(changeTimes)">
    <skylineValues id="birthRate" spec="bella.BayesMLP" nodes="$(nodes)">
        <predictor spec="RealParameterFromXSV" fileName="$(birthRatePredictorFile)"/>
        <plate var="n" range="$(layersRange)">
            <weights idref="birthRateW$(n)"/>
        </plate>
        <outputActivation spec="bella.activations.Sigmoid" lower="$(birthRateLower)" upper="$(birthRateUpper)"/>
    </skylineValues>
</birthRate>

The death-rate block is identical except the predictor is provided directly as a vector in data.json.

Step 3: Run the analysis

From the repository root:

beast -DF FBD/data.json FBD/config.xml

Step 4: Inspect outputs

The example writes:

You can now plot skyline rates and interpret how BELLA mapped predictors to parameters 🎉.

Customizing for your own data

Start by editing data.json first:

If you need more flexibility, edit config.xml directly. It contains inline comments that point to the main BELLA sections.