In this exercise, we will use Data explorer to set evidence on a Bayesian network, and run multiple queries via the Batch Query window.

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 'Identification Extended'

This network is available, from either:

  1. The SampleNetworks folder, that is packaged with the course help

  2. By working through Exercise - construction.

3 - Sql Server Express Database

A Sql Server express database (2008 or later) must be installed, before starting this walkthrough.

Note

The database must be setup (once) using the database script that accompanies the course notes.

4 - Data Connection

A data connection to the BSTRX database must have been created. See Exercise - Data Connection.

Open the Bayesian network

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

    Note

    Alternatively the network can be constructed manually in Exercise - construction.

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 Data drop down to IdentificationExtended.

    Click Ok. This will launch the Data Map window.

  4. In the Data Map window, leave the default mappings as shown below.

    Exercise Inference With Data Data Map

    Click Ok in the Data Map window.

    Data Explorer should now look like this.

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

  6. Press the keyboard shortcut F6 to query all nodes.

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

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 Data dropdown is set to IdentificationExtended.

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

  3. Clear the mapping for the Gender 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. If the Weight drop down has been automatically mapped to the Weight column, set it to map to nothing.

    Caution

    It is important to clear the weight mapping, as the Weight drop down is used to assign a case weight, which is unrelated to the weight variable in our network.

    The Data Map window should now look like this.

    Exercise Inference With Data Data Map No Gender
  5. Click the Ok button on the Data Map window. This will launch the Batch Query window.

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

    Predict(Gender)
    PredictProbability(Gender)
  7. Click the Start button. The Batch Query window should now look like this.

    Exercise Inference With Data Batch Query