Parameter learning is the process of using data to learn the distributions of a Bayesian network or Dynamic Bayesian network.

Bayes Server uses the Expectation Maximization (EM) algorithm to perform maximum likelihood estimation, and supports all of the following:

- Learning both discrete and continuous distributions.
- Learning both Bayesian networks and Dynamic Bayesian networks. (e.g. Learning from Time Series data).
- Learning with missing data (discrete or continuous).
- Learning on multiple processors.

The data used for learning must not change during the learning process.

With a Bayesian network or Dynamic Bayesian network open, the **Parameter learning** window can
be launched by clicking the **Parameter Learning**
button on the **Data** tab of the main window toolbar.

First the Data connection manager
will be launched to choose a **Data Connection** followed by the
Data tables and
Data map windows in
order to select tables, and map variables to columns.

Not all variables have to be mapped to data columns. Any variables that are not mapped are unobserved (have missing data) during the learning process.

To start learning click the **Start** button. When learning is complete, a
message box will be displayed.

The **Cancel** button, cancels the learning process, without producing a new candidate network.

The **Stop** button, stops the learning process, however does generate a candidate network, albeit
one that has had fewer iterations of learning.

If the **Reset** check box is checked when learning starts, all distributions are
first reset to their original values (i.e. the values when the **Parameter Learning** window
was opened).

When learning has completed without converging, sometimes it is useful to continue learning without starting from scratch. To do this, first ensure that the

ResetandInitializecheck boxes are not checked, then click theStartbutton again.

When the **Cache Data** check box is checked, learning data is copied into memory to avoid having to repeatedly
request the data from the data source, which can be expensive.

For large data sets this option should be turned off, as the data may not fit in memory.

The distributions to be learnt can be filtered by clicking the **Filter**
button. By default all distributions are learnt, however sometimes distributions are already known,
or have been estimated by experts.

For networks that contain temporal nodes (i.e. Dynamic Bayesian networks) and have multiple distributions, it can sometimes be useful to exclude a node's distribution at t=0, and specify it manually. This is especially true if there is only a single (or a few) time series/sequences.

For example, if data only includes a single time series, and a continuous node has multiple distributions, it can be useful to predefine the distribution at t=0 so that the variance is not solely based on the first point in a time series.

Click the **Options** button on the **Distributions** toolbar group, to set
options on individual distributions. This allows initialization to be turned on and off,
on a distribution by distribution basis.

The **Initialize** check box, determines whether or not distributions are initialized from the data,
before learning begins.

This allows learning with nodes whose distributions have not yet been specified.

Individual distributions can override this setting.

You can also select the initialization algorithm to use. **Random** will randomly sample data to initialize distributions whereas **Clustering** uses
a sophisticated clustering algorithm to initialize any latent variables. The **Clustering** initialization algorithm typically produces better solutions in less time.

The learning algorithm used by Bayes Server is an iterative algorithm. The **Max Iterations**
text box can be used to limit the number of iterations performed.

At each iteration during learning, the change in the distribution parameters is calculated.
If the change is less than the value in the **Tolerance** text box, the algorithm does not
perform any further iterations.

The value in the **Concurrency** text box, determines the maximum number of processors that are used
during parameter learning.

As this value increases, so does the memory required. This is because multiple inference engines are created to process any queries required during learning.

Additional options can be changed, by clicking the dialog launcher button at the bottom right of the options group on the toolbar.

If initialization is turned on, the initialization **Sampling Probability**,
determines the percentage of the learning data that should be used to initialize distributions,
by random assignment. A probability value greater than 0 but less than or equal to 1 (use all data) determines
the amount of data to use.

For information about the **Prior** options, consult the following pages in the Bayes Server API help:

`BayesServer.Learning.Parameters.Priors.Continuous`

`BayesServer.Learning.Parameters.Priors.Discrete`

`BayesServer.Learning.Parameters.Priors.IncludeGlobalCovariance`

`BayesServer.Learning.Parameters.Priors.SimpleVariance`

A **Seed** can be specified to initialize the random number generator used by the learning algorithm.
This option should not be used if **Concurrency** is greater than 1.

During parameter learning, queries may be executed.
This is known as **inference**. The **Algorithm** drop down allows the inference algorithm
to be changed.

The default inference algorithm is optimized for learning parameters.

Distributions can be monitored, to see how they change during the learning process.

Click **Add monitor** to add a new monitor. After selecting a distribution to monitor,
data can optionally be selected to plot on the resulting chart(s). This is usually the learning
data.

To delete an existing monitor, either

- Click the
**Delete monitor**button on the toolbar. - Right click on the tab containing the monitor, and then click delete on the context menu.

In addition to monitoring distributions, the log likelihood can also be monitored during learning.

The final log likelihood is always calculated at the end of learning, regardless of whether the

Log Likelihoodcheck box is checked. Monitoring the log likelihood can be expensive, so is off by default.

The following views are available in the **Parameter Learning** window.
If a view has been closed, it can be reopened using the
**View** tab on the toolbar.

The **Charts** view, charts the learning progress.

The **Delta** chart displays the difference in parameters
between iterations.

It is normal for

Deltato go both up and down. This does not indicate a problem.

If **Log Likelihood** is checked on the monitoring toolbar group,
a chart of the log likelihood is also displayed.

Each time learning completes successfully, a candidate network is added to the **Candidate Networks** view.

Each candidate network displays the following information:

**Created**- the time learning completed for this candidate network.**Converged**- indicates whether learning converged.**Iteration Count**- the number of iterations performed.**Log Likelihood**- the log likelihood of the data, given the candidate network.**BIC**- Bayesian Information Criterion (see`BayesServer.Learning.Parameters.ParameterLearningOutput.BIC`

in the Bayes Server API).

Click on a header to sort the grid.

To delete one or more candidate networks, select the networks to delete, and click the **Delete** button.

The **Iterations** view provides information about each iteration.

**Delta** is the difference between the parameters.

If the **Log Likelihood** check box on the monitoring toolbar group is checked (which can be expensive),
the log likelihood is displayed at each iteration.

If monitors have been added via the **Monitoring** toolbar group,
charts of distributions are displayed, and automatically update after each
iteration.

When learning has completed, the slider can be used to replay the changes.