In this exercise we will calculate time series queries (predictions) using a Dynamic Bayesian network.

Prerequisites

1 - Bayes Server

Bayes Server must be installed, before starting this walkthrough.

Note

An evaluation version can be downloaded from the Bayes Server website.

2 - The Bayesian network 'HiddenMarkovModel' available from the SampleNetworks folder, that is packaged with the course help.

Open the Bayesian network

  • Launch Bayes Server and open the Bayesian network HiddenMarkovModel.bayes located in the SampleNetworks folder, that is packaged with the course help.

Add queries

  1. Press the keyboard shortcut F6 to query all nodes. This will launch the Series query window.

  2. Click Ok to accept the default settings in the Series Query window, which will predict 5 time steps into the future.

Data Explorer

  1. Open Data Explorer by clicking the Data explorer button on the View tab of the main ribbon toolbar.

  2. Click the Load button on the Data Explorer ribbon toolbar. This will launch the Data Selection window.

  3. Select the data connection named localhost\sqlexpress (BSTRX) set up in Exercise - Data Connection in the Data Connection drop down.

    Then set the table in the Temporal Data drop down to HiddenMarkovModel.

    Click Ok. This will launch the Data Map window.

  4. Clear the mapping for the Cluster variable, leaving the default settings for the other variables.

    Tip

    To clear a mapping for a variable click the Eraser button next to the variable.

  5. Ensure that the Case Id Column drop down has been automatically mapped to the Case column.

    Also ensure that the Time Column drop down has been automatically mapped to the Time column.

    The Data Map window should look like this:

    Exercise InferenceIIData Map No Cluster

    Click Ok in the Data Map window.

  6. Double click on a row of data in Data Explorer, and notice how the data is set as evidence on the Bayesian network.

    Note

    Also note that since we added queries that used relative time, the predictions start after the maximum evidence time.

    Data Explorer should look something like this.

    Exercise InferenceIIData Explorer
  7. Now try double clicking different rows of data in Data Explorer, noticing how the Bayesian network and associated queries are updated.

    Note

    This data set contains time series of the same length, but varying length sequences are also supported.

Batch query

  1. Open the Batch Query window by clicking the Batch Query button on the Data tab of the main ribbon toolbar.

    This will launch the Data Selection window. Ensure that the Data Connection is set to localhost\sqlexpress (BSTRX), and the Temporal Data dropdown is set to HiddenMarkovModel.

  2. Click the Ok button on the Data Selection window, which will launch the Data Map window.

  3. Clear the mapping for the Cluster variable, leaving the default settings for the other variables.

    Tip

    To clear a mapping for a variable click the Eraser button next to the variable.

  4. Ensure that the Case Id Column drop down has been automatically mapped to the Case column.

    Also ensure that the Time Column drop down has been automatically mapped to the Time column.

    The Data Map window should look like this:

    Exercise InferenceIIData Map No Cluster

    Click the Ok button on the Data Map window. This will launch the Batch Query window.

  5. Click the checkbox next to the following items in the pane on the left of the Batch Query window.

    Predict(Obs1)
    Predict(Obs2)
    Predict(Obs3)
    Predict(Obs4)
  6. Click the Start button. The Batch Query window should now look like this.

    Exercise InferenceIIBatch Query
  7. Next, click different cases (rows) in the top results pane. This will then display the predictions for the selected case in the bottom results pane.