Skip to Content
BayesiaLabBayesiaLab User GuideMenusInferenceParameter UpdatingExample 1: Parameter Updating for One Node

Example 1: Parameter Updating for one node

We start with a single node representing Sex\mathit{Sex}, which has a uniform distribution, i.e., a 50/50 mix of Male\mathrm{Male} and Female\mathrm{Female}. For a compact presentation, we show the node Sex\mathit{Sex} here in Monitor Style, which means that, in Validation Mode, the distribution of the states is directly shown on the node.

Loading SVG...

Before starting Parameter Updating, we specify the Prior Weight and Discount via the Node Editor. Open Node Contextual Menu > Edit, choose Probability Distribution, then select Updating. Here, we set Prior Weight to 100. This means that we consider our prior equivalent to a population of 100 individuals, 50 male and 50 female. We leave Discount at its default value of 1. With this setting, we stipulate that no existing particles will be forgotten as additional new particles are added to the mix.

Loading SVG...

With node information visible, Sex\mathit{Sex} shows icons for Prior Weight and Discount in its upper-right corner.

Loading SVG...

You can start Parameter Updating in Validation Mode by selecting Menus > Inference > Parameter Updating. Then, a window prompts you to confirm the use of the currently specified Prior Weight or to select an alternative Prior Weight.

Manual Evidence using the current prior weight and discount 1
Click to Zoom

If a dataset is associated with the given network, BayesiaLab will prompt you for additional settings. You can specify, for instance, that the Prior Weights be computed from the associated dataset.

An associated data set makes Data Set and Compute Prior Weights from Data available
Click to Zoom

Additionally, you can choose the Evidence Source, which determines where to obtain the particles for Parameter Updating:

  • Manual Evidence means that new particles are coming from the evidence you set on the Monitors.
  • Data Set means that the observations stored in the associated dataset are retrieved to be used as particles.

For the one-node example, select Manual Evidence and Use Current Prior Weights. Keep the discount at 1.

Upon clicking OK, a new control panel appears on the Toolbar.

Parameter Updating toolbar before any evidence has been learned
Click to Zoom
  • Learn Evidence takes the evidence entered via the Monitors and updates the probability tables accordingly.
  • Reset removes all added particles and reverses any updates performed thus far.
  • Clicking the blue arrow button activates the inclusion of Not-Observable Nodes from an associated dataset or an Evidence Scenario File. By default, observations of Not-Observable Nodes are excluded from updating probabilities in the context of Parameter Updating.
  • Validate Updating opens a confirmation. Choosing Yes keeps the updated probabilities and closes Parameter Updating.
  • Stop Updating exits Parameter Updating without validating the updated probabilities. As a result, all updates are lost.
  • The counter shows how many particles have been added so far to update the probability tables.

Adding particles

We now take this network consisting of the single node Sex\mathit{Sex} and perform Parameter Updating by adding particles one-by-one. Before any evidence is set, the Information Panel shows a joint probability of 100%.

Information Panel before observing Sex, joint probability 100%
Click to Zoom

Particle #1

For the first particle, we set the evidence that Sex\mathit{Sex} is Female\mathrm{Female}. The Information Panel shows that the Joint Probability that Sex\mathit{Sex} is Female\mathrm{Female} is 50%, which is what we expect given the Probability Table we specified.

Monitor
Loading SVG...
Information Panel
The initial probability of observing Female is 50%
Click to Zoom

Upon clicking Learn Evidence, this new particle is mixed with the 100 virtual particles from the prior, and we now have a population of 51 females and 50 males. As a result, the probability table of the node Sex\mathit{Sex} is updated using Maximum Likelihood Estimation based on this new population. The new probability of the state Female\mathrm{Female} is now 50.5%. While we don’t see the probability table of the node Sex\mathit{Sex}, the Information Panel reports a Joint Probability of 51101≈50.5%\frac{{51}}{{101}}\approx 50.5\%.

Joint probability of observing Female after the first particle, 50.50%
Click to Zoom

Note that after adding the particle, the evidence remains set on Female\mathrm{Female}.

Particle #2

Upon clicking Learn Evidence, this evidence, i.e., Sex\mathit{Sex} is Female\mathrm{Female}, is added as a new particle and mixed with the 101 virtual particles, and we now have a population of 52 females and 50 males. The new probability of the state Female\mathrm{Female} is now 50.98% and the Information Panel reports a Joint Probability of 52102≈50.98%\frac{{52}}{{102}}\approx 50.98\%.

Information Panel
Joint probability of Female after two female particles, 50.98%
Click to Zoom
Toolbar
The toolbar counter shows two learned particles
Click to Zoom

Note that after adding the particle, the evidence remains set on Female\mathrm{Female}.

Particle #3

Now for the third particle, we set the evidence that Sex\mathit{Sex} is Male\mathrm{Male}.

Monitor
Loading SVG...
Information Panel
Joint probability of Male before learning the third particle, 49.02%
Click to Zoom

Upon clicking Learn Evidence, this evidence, i.e., Sex\mathit{Sex} is Male\mathrm{Male}, is added as a new particle and mixed with the 102 virtual particles, and we now have a population of 52 females and 51 males. The new probability of the state Male\mathrm{Male} is now 49.51% and the Information Panel reports a Joint Probability of 51103≈49.51%\frac{{51}}{{103}}\approx 49.51\%.

Joint probability of Male after the third particle, 49.51%
Click to Zoom

With the counter at 3, click Validate Updating, then confirm with Yes.

Parameter Updating toolbar with three learned particles and validation enabled
Click to Zoom
BayesiaLab asks whether to keep the new Conditional Probability Tables
Click to Zoom

After validation, clear any remaining observation to see the new marginal probability distribution for Sex\mathit{Sex}, both on the node (in Monitor Style) and in the corresponding Monitor in the Monitor Panel.

Graph Panel
Loading SVG...
Monitor Panel
Loading SVG...

Furthermore, we can go into the Node Editor to see its updated status. The Node Editor shows that Prior Weight is now equal to 103:

  • 100 from the virtual particles defined via the original Prior Weight.
  • 3 from the particles we created by manually setting evidence.
Loading SVG...

Of course, we can also see the new marginal probability distribution in the Tabular tab.

Loading SVG...

Discounting

With Discount set to 1, we did not apply any discounting to earlier particles as newer particles came in. Repeating the same three observations with Discount set to 0.75 gives the following results.

Each new particle has weight 1. Before adding it, BayesiaLab multiplies both existing state counts by the discount. For example, the first female observation changes the female count from 50 to 50×0.75+1=38.550 \times 0.75 + 1 = 38.5. The updated state probability is its weighted count divided by the total weight.

Weighted counts

StepMaleFemaleTotal
05050100
137.538.576
228.12529.87558
322.0937522.4062544.5

Updated probabilities

ParticleMaleFemale
Initial50.00%50.00%
1 · Female49.34%50.66%
2 · Female48.49%51.51%
3 · Male49.65%50.35%