Skip to main content

Structural learning

In this tutorial we demonstrate the process of structural learning, which uses data to determine potential links for a Bayesian network.

Generate tutorial data

We will generate data from a known network, and then delete the links for that network before proceeding with learning.

  1. In the Bayes Server User Interface, open the Waste network from the Start page (or from File/Open).

  2. From the Application main tab, click Data Sources.

  3. Click Generate -> Generate 10k samples, then close the Data Sources dialog.

This will add 10k samples from the Waste network as a temporary data source. If you want more control over how the data is generated you can use Data Sampling.

Data Connection Manager

info

Note that structural learning supports missing data.

  1. From the Display main tab, click Select and then All Links.

  2. From the Build main tab, click Delete.

Waste delete links

Structural learning | Map Data

  1. From the Build main tab, click Link and then Structural Learning.

  2. In the Data Tables dialog, in the Data Connection drop down, select the 10k Waste samples that were just generated.

  3. In the Data drop down, select Data.

  4. Click Ok.

Data Tables

  1. In the Data Map dialog, check that all variables have been automatically mapped to data, then click Ok.

Structural learning | Search and score

  1. In the Structural Learning dialog, select the Search and Score algorithm.

Search and Score

info

You can find out more about the different algorithms in the structural learning documentation.

  1. In the Nodes to Learn page, ensure all nodes are selected, and click Next.
info

This page allows learning to be restricted to a subset of nodes if required.

  1. In the Link constraints page, ensure no link constraints are present, and click Next.

  2. In the Options page, leave the defaults, and click Next.

  3. On the Run page, click Run to start the learning algorithm, and wait until it completes.

  4. Once complete, the Candidate networks page will be displayed.

  5. Click on the Candidate network. The Selected Candidate Links display will show the links that have been discovered.

Candidate networks

  1. Click Finish. The new links will be added to the network.
info

The links generated will be similar to those from the original network, however they may differ slightly due to the samples that were generated.

Structural learning | Clustering (Optional)

In this optional step, we will run the structural learning algorithm again keeping the links discovered in the previous step, this time using a different algorithm that can help discover any additional hidden state.

  1. From the Build main tab, click Link and then Structural Learning.

  2. In the Data Tables dialog, check that the data source used previously is automatically selected, and click Ok.

  3. In the Data Map window, click Ok.

  4. In the Structural learning wizard, select the Clustering algorithm.

Clustering

  1. In the Nodes to Learn page, ensure all nodes are selected, and click Next.

  2. In the Link constraints page, click Add Existing.

Link Constraints

  1. In the Options page, check that the Test Single Cluster option is set to True, and click Next.
info

The Test single cluster option ensures the algorithm checks for the lack of any hidden state. When no hidden state is found, an addition Cluster node that is normally added to model it, will not be added.

  1. On the Run page, click Run to start the learning algorithm, and wait until it completes.

  2. Once complete, the Candidate networks page will be displayed.

  3. Click Finish.

  4. Look at the resulting network to see if a new Cluster node has been added. If it has, then the algorithm detected some hidden state, that was not modelled with the existing links/variables alone.

info

Your results may vary, because the clustering algorithm is non-deterministic. You may wish to run it multiple times.

info

Note that, if desired, the states in the new Cluster nodes, can be re-ordered using the Query Order States feature.

Cluster node

Next steps

Once structural learning is complete, typically the next step is to perform Parameter learning which determines the network distributions/parameters from data.

info

You can also elicit the parameters using experts, or you can learn some nodes from data and use experts for others.