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.
In the Bayes Server User Interface, open the Waste network from the Start page (or from File/Open).
From the Application main tab, click Data Sources.
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.
Note that structural learning supports missing data.
Delete existing links
From the Display main tab, click Select and then All Links.
From the Build main tab, click Delete.
Structural learning | Map Data
From the Build main tab, click Link and then Structural Learning.
In the Data Tables dialog, in the Data Connection drop down, select the 10k Waste samples that were just generated.
In the Data drop down, select Data.
Click Ok.
- In the Data Map dialog, check that all variables have been automatically mapped to data, then click Ok.
Structural learning | Search and score
- In the Structural Learning dialog, select the Search and Score algorithm.
You can find out more about the different algorithms in the structural learning documentation.
- In the Nodes to Learn page, ensure all nodes are selected, and click Next.
This page allows learning to be restricted to a subset of nodes if required.
In the Link constraints page, ensure no link constraints are present, and click Next.
In the Options page, leave the defaults, and click Next.
On the Run page, click Run to start the learning algorithm, and wait until it completes.
Once complete, the Candidate networks page will be displayed.
Click on the Candidate network. The Selected Candidate Links display will show the links that have been discovered.
- Click Finish. The new links will be added to the network.
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.
From the Build main tab, click Link and then Structural Learning.
In the Data Tables dialog, check that the data source used previously is automatically selected, and click Ok.
In the Data Map window, click Ok.
In the Structural learning wizard, select the Clustering algorithm.
In the Nodes to Learn page, ensure all nodes are selected, and click Next.
In the Link constraints page, click Add Existing.
- In the Options page, check that the Test Single Cluster option is set to True, and click Next.
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.
On the Run page, click Run to start the learning algorithm, and wait until it completes.
Once complete, the Candidate networks page will be displayed.
Click Finish.
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.
Your results may vary, because the clustering algorithm is non-deterministic. You may wish to run it multiple times.
Note that, if desired, the states in the new Cluster nodes, can be re-ordered using the Query Order States feature.
Next steps
Once structural learning is complete, typically the next step is to perform Parameter learning which determines the network distributions/parameters from data.
You can also elicit the parameters using experts, or you can learn some nodes from data and use experts for others.