Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Since BayesiaLab's initial release in 2002, this User Guide has grown from a small help file to a comprehensive software documentation, now exceeding 1,500 topics.
With the BayesiaLab software eco-system continuing to grow rapidly, this User Guide is very much a living document, with more details being added daily. Plus, the annual cycle of major releases adds countless new features.
Beyond documenting the software functionality, this User Guide also serves as a reference to BayesiaLab-related nomenclature.
Many of BayesiaLab's analysis functions are entirely new and unique in the world of research, so many BayesiaLab-specific terms are neologisms. Here, you can find what we mean with expressions such as "Target Dynamic Profile" or "Likelihood Matching."
In this User Guide, you will also find many cross-references to examples and case studies presented in seminars, webinars, and our e-book, now available as a free online edition within this Knowledge Hub.
This User Guide's tree structure mirrors the BayesiaLab software's structure.
For instance, if you want to learn about the details of the function located in BayesiaLab's menu structure at Main Menu > Analysis > Visual > Overall > Arc > Mutual Information
, the corresponding documentation resides in this User Guide at:
Main Menu | Analysis | Visual | Overall | Arc | Mutual Information.
If the same function is accessible via multiple paths, e.g., from the Main Menu, from the Graph Panel Context Menu, and the Node Context Menu, the main documentation of this function will be attached to the highest level in the hierarchy in this case, the Main Menu. All other mentions of the function will refer back to this main entry.
BayesiaLab runs inside the Application Window.
Inside the Application Window, there are four main elements:
The Main Menu serves as the top-level navigation to all features and tools in BayesiaLab.
The Toolbar provides quick one-click access to frequently used functions.
The Graph Window is your work surface for creating and editing Bayesian network graphs.
Each Graph Window corresponds to a Bayesian network, which you can save as a file in XBL format.
The Graph Bar, at the bottom of the Main Window, allows you to manage multiple Graph Windows, which can all be opened simultaneously.
This command saves the current Bayesian network in a new file, adding an iteration number in parentheses to the current file name as a suffix.
If your current network is named Graph.xbl, the Increment & Save function will save it as Graph(2).xbl and not overwrite the original Graph.xbl file.
With each further iteration of Increment & Save, the counter in the suffix will increase by 1 unit, i.e., Graph(3).xbl, Graph(4).xbl, etc.
This is a helpful function for maintaining a history when developing a model, allowing you to revert to an earlier version when necessary.
Save As lets you choose a new file name and location for your current Bayesian network.
Additionally, you can specify what you wish to include in the to-be-saved file. Clicking on the icons to the right of the file list allows you to toggle on and off specific contents:
The Main Menu serves as the top-level navigation in BayesiaLab.
Most functions and tools are available through multiple levels of submenus attached to the Main Menu.
However, in many cases, these functions are also accessible in the context of specific workflows.
As a result, this User Guide often shows multiple ways of launching the same tool or function.
The Main Menu can appear in three different configurations, and certain menu items and icons will only be available in specific contexts:
Saves the Bayesian network in the active Graph Window using the XBL format.
You can edit these default settings under Main Menu > Window > Prefences > Data
.
If the Bayesian network has a Junction Tree, it will be also automatically saved in the same file.
With Open, you can select a Bayesian network file via a File Dialog and load it into Graph Window.
To the right of the file list, a preview panel shows you the structure of the Bayesian network to be loaded.
Additionally, you can specify what you wish to load along with the to-be-opened file. Clicking on the icons to the right of the file list allows you to toggle on and off specific file contents:
The Files of Type dropdown menu allows you to filter the types of Bayesian network formats to be displayed in the file list.
In addition to BayesiaLab's XBL format, select versions of BIF, NET, SSS, SCI, and DNE formats may be supported.
Bayesia does not guarantee the compatibility of BayesiaLab with any third-party or open-source Bayesian network formats.
The Network menu includes a range of standard functions related to:
Creating new files
Opening and closing files
Generating reports with network statistics
Clicking on the menu item Startup Page brings up a window featuring 12 quick-access cards.
The top row features some of the most common user actions after starting BayesiaLab:
Manually Create a Network
Open a Bayesian Network
Learn a Network from Data
Open the Media Center
The bottom two rows of cards show the most recently opened files with a network preview.
By default, the Startup screen is displayed right after launching BayesiaLab. The checkbox allows you to disable its automatic display.
Provides a list of the most recently opened networks so you can quickly reopen them as needed.
Set Working Directory allows you to define a Working Directory, i.e., a workspace, by associating a name with a specific directory.
With Recent Working Directories, you can quickly recall a Working Directory you previously specified.
The list features the name you assigned plus the corresponding path.
Closes all graphs, prompts you to save if needed and closes BayesiaLab.
Allows exportingtheMarkovblanketofthetargetvariable of the current network into a language selected in the following dialog box:
Once the network is exported in a language, it can be used to infer the value of the target variable according to the observations of the other variables.
Allows locking the network with a password to prevent it from being edited. Then, the network can be used only in Validation Mode. This menu gives access to the lock manager.
Prints the Bayesian network of the active graph window. An assistant gives access to:
the setup of the page-setting,
the configuration of the printer,
the selection of the desired scale for the network,
the possibility of displaying reference marks. These marks are useful when the network has to be print on more than one page. They indicate the page number (column, row), the border, and the vicinity,
the possibility to center the network.
Save the Dataset with the network.
Save the Evidence Scenario File with the network, if available.
Save the Junction Tree with the network, if available.
Save the Virtual Dataset with the network, if available.
Save the Simulator, i.e., load the WebSimulator configuration, if available.
By default, any dataset associated with the Bayesian network and any will be saved in the same XBL file so that they can be jointly loaded again later.
Load the Dataset with the network.
Load the with the network, if available.
Load the Junction Tree with the network, if available.
Load the Virtual Dataset with the network, if available.
Load the Simulator, i.e., load the configuration, if available.
Closes the active and prompts you to save the corresponding file, if your network, the associated dataset, or the were changed since the last operation.
Closes all open , except for the active one, and prompts you to save the corresponding files, if any of them were modified.
Closes all open and prompts you to save the corresponding files if any of them were modified.
The size of this list can be modified under Main Menu > Window > Preferences > Menus.
Enter your desired Working Directory name into the Name field and select the corresponding Path using the Directory dialog .
Once a Working Directory is set, it will serve as the default location for all file operations, such as , , etc.
Subsequently, you can recall the directories you defined with the menu item .
Clicking Recent Working Directories opens up a list of the most recently used Working Directories, from which you can pick the one you wish to recall.
The size of this list can be modified under Main Menu > Window > Preferences > Menus. See .
Closes the active Graph Window and prompts you to save the corresponding file if your network, the associated dataset, or the Evidence Scenario File were changed since the last Save operation.
This password locking mechanism allows you to share your networks to make sure they will not be modified by unauthorized users.
When a network is locked, you cannot validate and save the modifications done in the Node Editor, add or delete arcs and nodes, associate dictionaries and databases for learning, modify classes, etc.
To start protecting a network select Main Menu > Network > Protect
.
Unless the network already has a lock, the following dialog box is displayed:
When the network is unlocked, the menu Network | Lock displays the following dialog box:
This dialog box allows you to:
lock the network using the existing password,
remove completely the Lock,
change the Lock Password.
However, you can still edit the costs associated with the nodes as they are utilized only in the (e.g, Adaptive Questionnaire, not observable nodes, etc.).
Upon confirmation of your password, the Lock icon appears in the Status Bar to indicate that the network is unlocked.
You just have to click on the icon to lock/unlock the network. The icon updates to to indicate that the network is locked.
The Reports submenu within the Network menu offers an array of information about the Bayesian network in the active Graph Window.
The Network Report is a very comprehensive documentation of the network in the active Graph Window.
It includes statistics about the network structure as a whole, plus details for each node, such as the Node States, the Conditional Probability Tables, and equations.
As such, it presents all qualitative and quantitative knowledge contained in the network as a long, tabular report.
To some extent, you could recreate the network from all these details.
Select Main Menu > Network > Reports > Network
to create the Network Report.
The report can be quite substantial, depending on your network's size and complexity.
The following screenshot only shows the top portion of a much longer report:
For a thorough offline analysis, you may want to save the Network Report as an HTML file, which you can then open as a spreadsheet in Excel.
The Network Comments Report displays the information recorded in a network's Comment field.
And if available, the Network Comments Report also lists the associations of Node Names, Long Names, and Node Comments.
Select Main Menu > Network > Report > Comments
.
The Network Comments window opens, and a typical report resembles the following screenshot.
For a network that is in an early stage of development with little customization, the Network Comments Report may only feature default information:
Network Comments provides space for notes, descriptions, and references regarding a Bayesian network.
In the Network Comments field, you can enter and edit paragraph-style text.
You can access the Network Comments Editor in two ways:
Main Menu > Network > Properties > Comments
.
Graph Panel Context Menu > Properties > Comments
.
A new window opens featuring the Node Comments Editor.
By default, the Node Comments field contains the date and time the file was created, plus the user that created the file.
Alternatively, the Network Comments field displays any custom text you may have defined, such as a problem domain description.
You can apply HTML-style formatting to your text using the toolbar, including links and images.
Note that Network Comments are automatically saved with the network file.
If you share your network file with others, the information contained in Network Comments will be accessible to them.
Occurrences refer to the number of observations in a cell of a Probability Table or a Conditional Probability Table.
The number of cells in a Conditional Probability Table is a function of the following parameters:
The number of Parent Nodes.
The number of Node States of the Parent Nodes.
The number of Node States of the Child Nodes.
Here, Age is discretized into 4 states and BMI into 6 for a total of 48 cells in the table associated with BMI.
The numbers in each cell are counts of observations or Occurrences. In our case, each Occurrence represents one person from the sample of 200 individuals.
For instance, the Occurrence table associated with BMI states that Count(BMI≤20 | Age≤30)=2. So, we have only two Occurrences of that particular condition, i.e., only two individuals who are 30 years old or younger have a BMI of 20 or lower.
To create a Bayesian network, BayesiaLab needs to translate the Occurrences in each cell into probabilities.
However, with a small number of Occurrences, that can become an issue.
We have repeatedly referenced a rule of thumb, which says that we should have a minimum of 5 Occurrences per cell to estimate a Probability Table or Conditional Probability Table reliably.
In our example, several cells fall below the recommended minimum.
Such deficiencies are easy to recognize in a small example, but in more complex networks, it can be difficult to spot such weaknesses.
That is the motivation for the Occurrence Report. It displays all tables in a network and visually highlights potentially problematic cells with low Occurrences.
Select the nodes you want to include in the Occurrences Report. I none are selected, the analysis will be performed on all nodes.
Select Main Menu > Network > Reports > Reports> Occurrences
to create the Occurrences Report.
The Occurrence Report opens up and shows all Probability Tables and Conditional Probability Tables.
The fields in the report are color-coded to highlight potential issues:
Cells with 0 Occurrences are marked in red.
Cells with 5 Occurrences are marked in yellow. This is generally considered the minimum number of Occurrences.
Cells with 40 or more Occurrences are marked in green.
Furthermore, the Occurrence Report calculates the mean number of Occurrences for each row in all Probability Tables and Conditional Probability Tables.
If the mean value of any row in any of the nodes drops below the threshold of 5, the corresponding nodes are called out at the top of the report.
Whenever you learn a Bayesian network from a small dataset, you must consider whether the number of observations is sufficient for correctly estimating all Probability Tables and Conditional Probability Tables in the network.
For instance, using the Occurrences Report, you can evaluate whether all Conditional Probability Tables in your network meet the rule-of-thumb criterion of at least 5 observations per cell.
For a deeper analysis, BayesiaLab can produce the Confidence Intervals Report, which we discuss on this page.
To understand how Confidence Intervals can be computed, we first need to explain the estimation of probabilities in the Probability Tables and Conditional Probability Tables, the so-called parameters.
In BayesiaLab, these parameters are estimated using Maximum Likelihood, i.e., using the frequencies observed in the dataset:
where:
So, the Parameter Estimation is straightforward and happens entirely in the background in BayesiaLab.
As a result, we may not always be aware of what numbers gave rise to the probabilities we see in a Probability Table or Conditional Probability Table, as the following diagram illustrates:
However, in terms of our confidence in the estimate, the two approaches are not the same. Our intuition tells us that we should have more confidence in the 0.1 value calculated based on the sample of 10,000.
BayesiaLab is using precisely the same approach for the Confidence Intervals Report.
However, in BayesiaLab, you can avoid resorting to this heuristic by using Uniform Prior Samples.
Within this network, focus on the three nodes BMI, Age, and Gender:
Go to Main Menu > Network > Reports > Confidence Intervals
to start the Confidence Intervals Report.
The Confidence Interval Report window opens up.
At the top of the report, the Confidence Level that serves as the basis for the reported Confidence Intervals is displayed.
Then, for each node, one table is shown.
For each cell containing a parameter estimate, an adjacent cell to the right displays the corresponding Confidence Interval in percentage points.
The color-coding scheme is identical to the one used in the Occurrences Report.
The fields in the report are color-coded to highlight potential issues:
Cells with 0 Occurrences are marked with a red background.
Cells with 5 Occurrences are highlighted with a yellow background. This is generally considered the minimum acceptable number of Occurrences.
Cells with 40 or more Occurrences are marked with a green background.
You can adjust the Confidence Level used for this report.
Go to Main Menu > Window > Preferences > Tools > Statistical Tools
.
Select the desired value from the Confidence Level dropdown menu.
Note that your selection here also applies to all other statistical tools and tests used in BayesiaLab.
In Step 2 — Definition of Variable Types of the five-step Data Import Wizard, you need to define variable types.
Step 2 contains four panels that relate to each other in their content and available actions.
With the radio buttons in the Type panel, you can define the type of each variable.
Before you start making your determinations, BayesiaLab has already made some guesses regarding the appropriate variable type, i.e., Discrete versus Continuous.
Furthermore, some variables have limited options regarding the variable type because of their distributions:
If a variable has the same value for all observations, it falls into the Unused variable type. Such a not-distributed variable cannot be imported at all into BayesiaLab.
Variables that contain any text values cannot be declared Continuous variables.
Variables with Missing Values cannot be of the type Weight, Row Identifier, or Learn/Test.
To select a variable, click on the variable header or click anywhere inside the column in the Data panel.
You can perform the selection of multiple variables with keystroke combinations commonly used in spreadsheet editing:
Ctrl+Click
: add a variable to the current selection.
Shift+Click
: add all variables between the currently selected and the clicked variable to the selection.
Ctrl+A
: select all variables in the Data panel.
Shift+End
: select all variables from the currently selected variable to the rightmost variable in the table.
Shift+Home
: select all variables from the currently selected variable to the leftmost variable in the table.
The current selection is highlight by showing the selected columns in a darker shade of their current color.
Discrete
The Discrete type considers each unique value of the variable a distinct state.
Any variable that contains text will be considered Discrete by default.
The maximum number of unique values that can be accommodated can be specified under Main Menu > Window > Preference > Editing > Node > Maximum Number of States
.
Continuous
The Continuous type applies to numerical variables, which must be discretized in Step 4 — Discretization and Aggregation.
If a variable contains integer values above a certain threshold, the variable will be considered Continuous.
You can specify this threshold under Main Menu > Windows > Preferences > Data > Import & Associate > Threshold for Assuming Integers as Continuous
. The default threshold value is 5.
Learn more about Discrete and Continuous nodes in the Node Editor topic.
Weight
Weighting is often applied to surveys to make a survey sample representative of the demographics of the underlying population.
If your dataset contains such a Weight variable, select it by clicking on the corresponding column.
Then, select the Weight button in the Type panel.
Later, in Step 4 — Discretization and Aggregation, you can specify whether or not to normalize the Weight variable.
Learning/Test
For a dataset that has already been split into a Learning Set and a Test Set, you can use such an existing definition to import your data into BayesiaLab.
Both the Learning Set and the Test Set need to be in the same data table, rather than in separate files.
A binary indicator variable needs to identify each set with a unique code.
With a Learning/Test variable defined, in Step 4 — Discretization and Aggregation of the Data Import Wizard, you need to assign which of your codes corresponds to BayesiaLab's Learning and Test states.
Row Identifier
You can assign one or more variables to serve as Row Identifiers. The values of Row Identifiers are imported but not processed in any way. They serve as labels that are attached to each record.
There are numerous functions in BayesiaLab that allow you to look up what record in the dataset corresponds to what is currently on display on the screen.
For instance, Automatic Evidence-Setting displays the Row Identifier in the Status Bar.
By selecting the Unused button, you can skip the import of the selected variables. In previous versions of BayesiaLab, this option was also known as "Not Distributed."
Unused is automatically applied to variables containing only a single value across all observations, i.e., when the variable is "not distributed," hence the original name.
Unused variables will appear grayed out in the remaining steps of the Data Import Wizard.
The Multiple Typing panel allows you to quickly assign variable types across multiple variables.
Click Set All to Discrete to apply the Discrete type all variables, if possible.
Click Set All to Continuous to apply the Continuous type all variables, if possible.
By clicking either button, all previous type assignments are replaced.
You can automatically remove variables, i.e., set them to the Unused type, if they exceed a certain column percentage of Missing Values.
Click the Set Missing Values Threshold button.
From the pop-up window, set the percentage.
All variables that exceed the specified threshold are set to Unused.
The Information panel provides a range of statistics relating to the current type assignment of variables:
Number of Rows refers to the number of records in the to-be-imported datasets. In the context of datasets, rows, records, cases, samples, and observations all have equivalent meanings.
Discrete shows the absolute count of variables currently assigned to the Discrete type. The percentage refers to the proportion of Discrete variables among all variables, including the type Unused.
Continuous shows the absolute count of variables currently assigned to the Continuous type. The percentage refers to the proportion of Continuous variables among all variables, including the type Unused.
Others displays the count of all the variable assigned to the types Row Identifier, Weight, or Learn/Test.
Unused shows the absolute count of variables currently assigned to the Unused type. The percentage refers to the proportion of Unused variables among all variables.
Missing Values displays the count of cells in the dataset that contain Missing Values. The percentage refers to the proportion of cells in the dataset that contain Missing Values, including all variables types, even Unused, Row Identifier, and Learning/Test.
Filtered Values displays the count of cells in the dataset that contain Filtered Values, as indicated by the asterisk (*). The percentage refers to the proportion of cells in the dataset that contain Filtered Values, including all variable types, even Unused, Row Identifier, and Learning/Test.
The Data panel visualizes the current variable selection and type assignment with colors (see Usage above).
Horizontal and vertical scrolling allows you to view the entire dataset that will be imported.
The Data Import Wizard is the principal tool in BayesiaLab for preprocessing and importing external data.
You can use BayesiaLab's Data Import Wizard to import data from two types of sources:
Data tables in text format, in which data fields are separated by delimiters, such as comma, semicolon, tab, or pipe "|". The most common format is CSV.
Data tables in SQL-compatible databases can be accessed via a JDBC driver. Third-party JDBC drivers are available for all major databases.
All data sources must be structured as a single table, i.e., with rows and columns. All table joins must be performed before importing the data in BayesiaLab.
To launch the Data Import Wizard for a data table in a
text file, select Main Menu > Data > Open Data Source > Text File
.
database, select Main Menu > Data > Open Data Source > Database
.
Then, the Data Import Wizard guides you through five sequential steps. The first step of the Data Import Wizard depends on the data source, i.e., text file or database. All subsequent steps of the Data Import Wizard are the same for both types of data sources.
Data Structure Definition
Data table in a database
Definition of Variable Types
Data Selection, Filtering, and Missing Value Processing
Discretization and Aggregation
Import Report
BayesiaLab can load data from flat text files (e.g., CSV, TXT) or connected databases.
In Step 1 — Data Structure Definition: Text File of the five-step Data Import Wizard, you need to define the dataset structure for BayesiaLab so that the data can be imported and interpreted correctly.
The Data Structure Definition window opens up.
Specify all Settings & Options (see below).
Many of the settings can be immediately reviewed and validated in the Data Preview panel. However, Missing Values or Filtered Values can be mischaracterized and yet go unnoticed and, later, introduce major problems causing misleading analysis results.
The Data Import Wizard will attempt to automatically identify the separator or delimiter of the fields in the data table.
However, there can be ambiguous situations in which you need to specify the separator by checking the appropriate box:
Tab
Semicolon
Comma
Space
Other
If you prepare a dataset externally for import into BayesiaLab, ensure that separators are unique and do not appear as content in any data field. So, if any data fields contain text with commas as content, you cannot use commas as the separator. In such a case, try a tab or semicolon.
The Encoding drop-down list allows you to select an alternative encoding for the dataset to be imported. This can become necessary for importing data from certain legacy systems.
Specifying the correct code for Missing Values is very important so that BayesiaLab can process such Missing Values appropriately.
The list shows a number of codes that are commonly used for Missing Values. However, this is not necessarily comprehensive, and your dataset may contain different codes, such as "." (dot) or "-9999", etc.
Click Add to create a new entry in this list for the current data import.
Clicking Remove deletes the selected entries.
Deleting a default entry such as NR (for no response) may become necessary, for instance, if a data field contains the string "NR" as a valid value. That would be the case if your data set included New York Stock Exchange ticker symbols. In this context, "NR" would be the symbol of Newpark Resources, Inc. Unless you address this issue, all "NR" strings would be treated as Missing Values.
You can set your own default list of codes under Main Menu > Windows > Preferences > Data > Import & Associate > Missing & Filtered Values
.
Just as important as the correct definition of Missing Values is a clear understanding of a Filtered Value.
A Filtered Value occurs when a variable cannot have any value for logical reasons. For instance, in a demographic dataset, there could be a field Age at Retirement. However, in the record of a 16-year-old high school student in this dataset, there could be no value for the field Age at Retirement. However, this situation must not be treated as a Missing Value! A Missing Value implies that a value exists but is unknown. In the case of the student's record, a value is logically impossible, not missing. So, instead of a numerical value or a blank, you must specify a code that says that there can be no value. This is the purpose of assigning a Filtered Value code.
Importantly, you must encode any Filtered Values before importing your dataset into BayesiaLab. In BayesiaLab, you merely need to declare what code you used in your dataset to represent Filtered Values. BayesiaLab will create a Filtered State as an additional state in each node for which Filtered Values are encountered during data import.
Click Add to create a new entry in this list for the current data import.
Clicking Remove deletes the selected entries.
You can set your own default list of codes under Main Menu > Windows > Preferences > Data > Import & Associate > Missing & Filtered Values
.
In Data Preview, all Filtered Values are marked with an asterisk (*) in the data table.
Understanding the difference between Missing and Filtered Values is critically important.
Clicking Define Sample button opens a window that allows you to sample records from your data source.
This is particularly useful for the preliminary analysis of large datasets. By default, BayesiaLab imports all records from the data.
You can define a subset in three ways:
Random Sample — Size in Percent: specify the size of the random sample as a percentage of the original dataset size.
Random Sample — Size: specify the number of records in the sampled dataset.
Custom Range — First Row to Last Row: specify the range of records to be imported.
Checking the option Fixed Seed and specifying a number ensures that you can repeat exactly the same random sampling for each iteration of the import. This allows you to reproduce your results as you develop your model.
By default, the Data Import Wizard loads the entire dataset as a Learning Set.
By clicking the Define Learning/Test Sets button, you can set aside a Test Set (or holdout sample).
You can define the Learning Set/Test Set split in three ways:
Random Test Set — Size in Percent: specify the size of the Test Set as a percentage of the original dataset size.
Random Test Set — Size: specify the number of records in the Test Set.
Custom Test Set — First Row to Last Row: select a specific range of records for a Test Set.
Checking the option Fixed Seed and specifying a number ensures that you can obtain the same Test Set with each iteration of the import. This allows you to reproduce your results and validation measures as you develop your model.
In addition to specifying a Learning Set/Test Set split here, you can define a split in other ways:
You can designate a variable in the original dataset to assign records to the Learning Set and Test Set. You can select such a variable in the next step of the Data Import Wizard: Step 2 — Definition of Variable Types.
Main Menu > Data > Data Set > Generate Learning/Test Split
Furthermore, you can remove the Learning Set/Test Set split at any time:
Main Menu > Data > Data Set > Remove Learning/Test Split
.
The Options Panel allows you to manage the interpretation of the to-be-imported dataset.
Title Line:
By checking this option, BayesiaLab reads the first row of the dataset and uses its values as column headers.
If the values in the first row are not compatible, e.g., due to missing values or duplicate values, you are prompted to accept the proposed corrections, which include adding suffixes for duplicate names and substituting missing values with generic column headers, e.g., N0, N1, N2, etc.
End of Line Character:
With some files, it may be necessary to specify a certain character so that BayesiaLab can correctly detect the end of a row in a data table.
Consider Identical Consecutive Separators as One:
Check this box so that if you have multiple consecutive separators of the same type, e.g., “;;;”, the Data Import Wizard will treat them as a single separator.
Consider Different Consecutive Separators as One:
Check this box so that if you have multiple consecutive separators of any type, e.g., “;,|”, the Data Import Wizard will treat them as a single separator.
Double Quotes:
Remove
As String Delimiters
Simple Quotes:
Remove
As String Delimiters
Transpose:
By default, BayesiaLab expects the data source to be arranged in
columns corresponding to variables and
rows corresponding to samples, records, or observations.
Checking the Transpose option allows you to accept an alternate format, i.e.,
rows corresponding to variables and
columns corresponding to samples, records, or observations.
The transposed format is commonly used in bioinformatics. For instance, variables representing genes — sometimes tens of thousands — are arranged row by row. Observations — sometimes only a few dozen — are placed in columns side by side.
The data table at the bottom of the window provides a preview of how the Data Import Wizard sees and interprets your dataset.
Blank fields indicate a Missing Value.
Asterisks (*) mark Filtered Values. In the dataset shown below, for instance, Filtered Values were assigned to all males and post-menopausal women for the variable Pregnancy Status. For those two groups and for obvious reasons, pregnancy is impossible.
Horizontal and vertical sliders allow you to scroll and view the entire dataset. Alternatively, you can move your mouse's scroll wheel up and down.
If a variable name exceeds the column width, you can click on the divider between column headers and drag it into the desired position. Alternatively, double-click the divider to auto-fit the column width to the variable name.
In the following animation, we show a dataset that requires numerous settings to be adjusted for proper import:
The dataset uses the pipe character ("|") as a delimiter.
All fields are enclosed in double quotes.
Multiple, arbitrary codes are used for Missing Values:
"Refused"
"unknown"
"Not Applicable" is the code for Filtered Value used in this dataset.
Note that there are no standardized codes for Missing Values and Filtered Values. They can be as arbitrary as in this example. Therefore, it is of utmost importance that whoever prepares the dataset must convey the precise meaning of these codes to the analyst who imports the data into BayesiaLab.
Step 3 of the five-step Data Import Wizard deals with Data Selection, Filtering, and Missing Values Processing.
This Data panel resembles the Data panel from Step 2 — Definition of Variable Types.
However, there are several important additional pieces of information available:
For Discrete variables, it shows the frequencies of all states, including Missing Values and Filtered Values:
As you experiment with checking/unchecking, you can see how the Number of Rows in the Information panel changes.
In terms of a data query, the Filter checkbox would be the equivalent of a nominal value row filter.
Note that the number of Filtered Values does not refer to the number of excluded rows due to an unchecked Filter checkbox.
For Continuous variables, it shows the standard statistics, such as Minimum, Maximum, Mean, and Standard Deviation. Additionally, the table displays the frequencies of non-missing values, Missing Values, and Filtered Values:
Three actions are available in this panel:
You can choose the logic for combining the Filters and Minima/Maxima assigned in the Data panel:
OR: a row will be removed if ANY of the selected Filters or specified Minima/Maxima across all variables apply to that row.
AND: a row will only be removed of ALL of the selected Filters and specified Minima/Maxima across all variables that apply to that row.
Click the Show Selections button to review what Filters and Minima/Maxima are currently in place.
Note the syntax for Discrete variables: The variable name is followed by "in" (i.e., is an element of) followed by the included values shown as an array in square brackets.
Further logical expressions are shown as conjunctions (AND) or disjunctions (OR) in separate lines.
Clicking the Delete Selections button removes all Filters and Minima/Maxima currently in place.
In the Missing Value Processing panel you can specify which kind of processing to apply to variables with Missing Values, i.e., Filter, Replace, and Infer.
The Filter function allows you to remove rows from the dataset that contain Missing Values. This is equivalent to what is commonly known as casewise deletion.
You can apply the Filter individually to any variable that contains Missing Values.
Usage
Then, check the Filter checkbox in the Missing Values Processing panel.
Next, choose the logical condition to apply when you select multiple variables to be subject to the Filter.
OR: a row will be removed if ANY of the selected variables contain a Missing Value in that row.
AND: a row will only be removed of ALL of the selected variables containing a Missing Value in that row.
Before applying Filter, please consider the implications discussed in Chapter 9: Missing Values Processing.
With the Replace By function, you can specify a value for replacing the Missing Values in the selected variable.
You have several options in this regard:
You can set a specific value:
For a Discrete variable, you can select among the values observed in the variable from a drop-down list.
Alternatively, you can choose the Modal value, i.e., the most frequently occurring value of the variable in the dataset.
For a Continuous variable, you can select to use the Mean value computed from the dataset.
As an alternative, you can specify any arbitrary value.
For practical analysis purposes, the Infer option is the most common method for Missing Values Processing.
The Methods in Detail:
Infer — Static Imputation
Infer — Dynamic Imputation
Infer — Structural EM
Infer — Entropy-Based Imputations
The following example with one Parent Node (Age, measured in years) and one Child Node (BMI, i.e., Body Mass Index, measured in ) illustrates this with numbers:
The affected nodes in the Graph Panel are also marked with the information icon .
is the estimated probability,
is the state of variable ,
represents the number of occurrences of the argument in the data set.
So, BayesiaLab could have estimated a probability of 0.1 (or 10%) for in numerous ways, e.g., based on a sample of 10 or 10,000: .
From Frequentist Statistics, we know how to calculate a Confidence Interval
for a proportion in a sample, which is exactly what the parameter represents.
So, for a Confidence Level of 95%, the Confidence Interval is calculated as:
where
If zero observations were observed for a given state, e.g., , the Rule of Three would have to be used instead to produce Confidence Intervals:
To illustrate the Confidence Intervals Report, we use the following network: NHANES_DEMO_BMX.xbl
brings data into BayesiaLab to create a new Bayesian network.
In Modeling Mode , select Main Menu > Data > Open Data Source > Text File
.
Click Next to proceed the .
Right-click on the database icon in the Status Bar and select Generate Learning/Test Split.
Right-click on the database icon in the Status Bar and select Remove Learning/Test Split.
(same as in )
We start with the Data panel — although it is at the bottom of the window — as it can help inform decisions about .
A Missing Values icon indicates the presence of at least one Missing Value in the corresponding variable.
A triangle icon indicates that variable-specific statistics are available. It appears on all variable headers with the exception of variables of the type and .
Clicking on the triangle icon or the associated variable header brings up a table with variable statistics:
The Filter checkboxes allow you to uncheck/deselect specific values.
The checked box means that the value is included, which is the default condition.
The unchecked box means that the value is excluded and that all rows that contain that value will be filtered, i.e., removed.
The Select Values panel relates to the checkboxes plus any applied in the panel.
This panel is only active if you select one of the variables that feature a small question mark icon . This icon indicates that the corresponding variable contains at least one Missing Value.
In the panel, click on the header or into the column of the variable with Missing Values.
To learn about Missing Values Processing beyond and , please see Missing Values Processing in Chapter 9 of our e-book.
The Information panel is identical in its functionality to the Information panel in . Please refer to that topic for details.
Step 4 — Discretization and Aggregation requires you to make several more important choices before concluding the import process.
As opposed to the previous steps, which all consisted of a single screen, Step 4 provides one screen per variable type for six screens.
As you go from Step 3 to Step 4, the variable that you last selected in Step 3 remains highlighted.
And depending on the variable type, Step 4 starts with one of six possible screens, one for each variable type. Click on the thumbnails in the following table for a preview.
Note that for Row Identifier and Unused variables, no actions are available. Except for the Data panel, the corresponding screens are blank.
For all other variable types, we discuss all available options in detail in separate sections:
Weights
Learning/Test
Discretization
Aggregation
This screen is only available if you designated a Weight variable in Step 2 — Definition of Variable Types.
Click on that Weight variable in the Data panel, and the Normalize Weights checkbox appears as the only option on the screen.
You need to determine whether to apply Normalize Weights or not:
If yes, the Weights will be normalized so that the total number of cases considered by BayesiaLab for machine learning is equal to the actual number of samples in the dataset.
If no, the Weight variable will be treated as representing the actual number of observed cases. So, a weight of 10 for one observation would be treated and counted like ten instances of that same observation. As a result, the total number of cases considered by BayesiaLab would correspond to the population from which the weight was calculated.
This example illustrates the situation for a survey consisting of 10 observations:
If you do not normalize, BayesiaLab would consider a sample of 100 for learning purposes and presumably find spurious relationships. This "over-counting" by a factor of 10 has the same effect as reducing the Structural Coefficient to 0.1.
If you normalize, BayesiaLab considers the correct proportions of the weighted samples but still only considers ten observations in total for learning purposes.
If you have specified a Weight variable, it will be taken into account in the Discretization and Aggregation algorithms.
Data
This menu item allows opening the file or the database selector and then starts the Data Import Wizard.
Text *file:* Once the file is read and the pre-processing done, a fully unconnected network is created in a new graph window, each attribute having one corresponding node. The set of Bayesian network learning methods becomes then available.
Database: Once the database table is loaded and the pre-processing done, a fully unconnected network is created in a new graph window, each attribute having one corresponding node. The set of Bayesian network learning methods becomes then available.
Recent databases: Keep a list of the recently opened databases. The Data importation wizard is directly opened on the selected file. The size of this list can be modified through the settings Menus .
This menu item allows opening the Data association wizard in order to associate data from a text file or a database with an existing Bayesian network.
Recent databases: Keep a list of the recently opened databases. The Data association wizard is directly opened on the selected file. The size of this list can be modified through the settings Menus .
When the network structure is modified during the association (addition of nodes or states), the conditional probability tables are automatically recomputed from the database. If the structure re- mains unmodified, the conditional probability tables are not modified.
This menu item allows defining the properties of the active Bayesian network thanks to text files. These properties concern arcs, nodes and states:
Arc:
Arcs: allows associating a set of arcs to the network. The indicated arcs can be added or removed from the network. The arc removal will always be done before adding an arc. Before adding an arc, all the constraints belonging to the Bayesian network as well as the arc constraints and the temporal indices will be checked. If a constraint is not verified, then the arc won't be added.
Forbidden Arcs: allows associating with the network a set of forbidden arcs .
Arc Comments: allows associating with the network a set of arc comments .
Arc Colors: allows associating with the network a set of colors on the arcs.
Fixed Arcs: allows defining if some arcs are fixed or not.
Node:
Node Renaming: allows renaming each node with a new name. These new names must be, of course, all different.
Comments: allows associating a comment with each node that is in the file.
Classes: allows organizing nodes in subsets called classes . A node can belong to several classes at the same time. These classes allow generalizing some node's properties to the nodes belonging to the same classes. They allow also creating constraints over the arc creation during learning.
Colors: allows associating colors with the nodes or classes that are in the file. The colors are written as Red Green Blue with 8 bits by channel in hexadecimal format (web format): for example the color red is 255 red 0 green 0 blue, it will give FF0000. Green gives 00FF00, yellow gives FFFF00, etc.
Images: allows associating colors with the nodes or classes that are in the file. The images are represented by their path relatively to the directory where the dictionary is.
Costs: allows associating with each node a cost . A node without cost is called not observable.
Temporal Indices: allows associating temporal indices with the nodes that are in the file. These temporal indexes are used by the BayesiaLab's learning algorithms to take into account any constraints over the probabilistic relations, as for example the no adding arcs between future nodes to past nodes. The rule that is used to add an arc from node N1 to node N2 is:
If the temporal index of N1 is positive or null, then the arc from N1 to N2 is only possible if the temporal index of N2 is greater of equal to the index of N1.
Local Structural Coefficients: allows setting the local structural coefficient of each specified node or each node of each specified class.
State Virtual Numbers: allows setting the state virtual number of each specified node or each node of each specified class.
Locations: allows setting the position of each node.
State:
State Renaming: allows renaming each state of each node with a new name.
State Values: allows associating with each state of each node a numerical value .
State Long Names: allows associating with each state of each node a long name more explicit than the default state name. This name can be used in the different ways to export a database, in the html reports and in the monitors.
Filtered States: allows defining a state to each node as a filtered state .
As indicated by the syntax, the name of the node, class or state in the text file cannot contain equal, space or tab characters. If the node names contain such characters in the networks, those characters must be written with a {color} (backslash) character before in the text file: for example the node named Visit Asia will be written Visit\ Asia in the file.
In order to specifically differenciate a nam which is the same for a classe, a node or a state, you must add at the end of the name the suffix "c" for a class, "n" for a node and "s" for a state.
If your network contains not-ASCII characters, you must save your own dictionaries with UTF-8 (Unicode) encoding. For example, in MS Excel, choose "save as" and select "Text Unicode (*.txt)" as type of file. In Notepad, choose "save as" and select "UTF-8" as encod- ing. If your file contains only ASCII character you can let the default encoding (depending on the platform) but it is strongly encouraged to use UTF-8 (Unicode) encoding in order to create dictionary files that doesn't depend on the user's platform. So, for example, a chinese dictionary can be read by a german without any problem whatever the used platforms are. If you are not sure how to save a file with UTF-8 encoding, you should export a dictionary with BayesiaLab, modify and save it (with any text editor) and load it in BayesiaLab.
This menu item allows exporting the different kinds of dictionaries in text files.
The dictionary files are saved with UTF-8 (Unicode) encoding in order to support any character of any language. An option, in the Import and Associate preferences: Save Format , allows saving or not the BOM (Byte Order Mask) at the beginning of the file. The BOM increases the compatibility with Microsoft applications. On other platform like Unix, Linux or Mac OS X, the BOM is not necessary and, in come cases, is considered as simple extra characters at the beginning of the file.
This menu item allows associating an evidence scenario file with the network.
This menu item allows exporting into a text file an evidence scenario file associated with the network.
This menu item allows saving the base associated with the network including the results of the various pre-processing that have been carried out within the data importation wizard (discretization, aggregation, filtering,). If the imported database still contains missing values and if the selected algorithm to process the missing values is one of the two imputation algorithms (static or dynamic), then option will allow you to realize all your imputation tasks by saving a database without any missing values. Indeed, each missing value is replaced by taking into account its conditional probability distri- bution, returned by the Bayesian network, given all the known values of the line. If the database contains data for test and data for learning, the user can choose which kind of data he wants to save: only learning data, only test data or the whole data. It is also possible to save only the data corresponding to the selected nodes.
The states' long name can be saved instead of the states' name. The numerical values in the database associated with the continuous nodes can be saved if they exist. If there is no numerical values asso- ciated with the database and if the option is checked, the numerical values will be created by randomly generating a value in each concerned interval. If the database contains weights, they will be saved as the first column in the output file.
Allows the imputation of the missing values of the associated database according to the mode selected in the following dialog box:
The data will be saved in the specified file and the long name of the states will be used as specified. If the database contains data for test and data for learning, the user can choose on which kind of data he wants to perform imputation: only learning data, only test data or the whole data. The states' long name can be saved instead of the states' name. The numerical values in the database associated with the continuous nodes can be saved if they exist. If there is no numerical values associated with the database and if the option is checked, the numerical values will be created by randomly generating a value in each concerned interval. However, if there are numerical values in the database, the missing numerical values will be generated from the distribution function of each interval. If the database contains weights, they will be saved as the first column in the output file.
Opens the graph editor if a database is associated with the current network.
Dictionary File Structures | ||
---|---|---|
Observation No.
Weight
Normalized Weight
1
10
1.0
2
12
1.2
3
8
0.8
4
9
0.9
5
11
1.1
6
13
1.3
7
7
0.7
8
4
0.4
9
15
1.5
10
11
1.1
Sum
100
10
Arc
Arcs
Name of the arc's starting node or class, -> , <- or even -- to indicate the both possible orientations, name of the arc's ending node or class, Equal, Space or Tab , true for an added arc or false for a removed arc. The last occurrence is always chosen.
Forbidden Arcs
Name of the arc's starting node or class, -> , <- or even -- to indicate the both possible orientations, name of the arc's ending node or class.
Comments
Name of the arc's starting node or class, -> , <- or even -- to indicate the both possible orientations, name of the arc's ending node or class, Equal, Space or Tab , comment . The comment can be any character string without return (in html or not). The last occurrence is always chosen.
Colors
Name of the arc's starting node or class, -> , <- or even -- to indicate the both possible orientations, name of the arc's ending node or class, Equal, Space or Tab , color . The color is defined as Red Green Blue 8 bits by channel color written in hexadecimal (web format). For example green gives 00FF00, yellow gives FFFF00, blue gives 0000FF, pink gives FFC0FF,etc. The last occurrence is always chosen.
Fixed Arcs
Name of the arc's starting node or class, -> , <- or even -- to indicate the both possible orientations, name of the arc's ending node or class, Equal, Space or Tab , true for an fixed arc or false for a not fixed arc. The last occurrence is always chosen.
Node
Node Renaming
Name of the node Equal, Space or Tab new node name. The new name must be valid (different from t or T and without?). A node can be present only once otherwise the last occurrence is chosen.
Comments
Name of the node or the class Equal, Space or Tab Comment. The comment can be any character string without return (in html or not). A node can be present only once otherwise the last occurrence is chosen.
Classes
Name of the node Equal, Space or Tab Name of the class. The class can be any character string. A node present several times will be associated with different classes.
Colors
Name of a node or a class Equal, Space or Tab Color The color is defined as Red Green Blue 8 bits by channel color written in hexadecimal (web format). For example green gives 00FF00, yellow gives FFFF00, blue gives 0000FF, pink gives FFC0FF, etc. A node can be present only once otherwise the last occurrence is chosen.
Images
Name of a node or a class Equal, Space or Tab path to the image relatively to the directory where the dictionary is. The image path must be a valid relative path or an empty string. A node can be present only once otherwise the last occurrence is chosen.
Costs
Name of the node Equal, Space or Tab value of the cost or empty if we want the node to be not observable. The cost is an empty string or a real number superior or equal to 1. A node can be present only once otherwise the last occurrence is chosen.
Temporal Indices
Name of the node Equal, Space or Tab value of the index or empty if we want to delete an already existent index The index is an integer. A node can be present only once otherwise the last occurrence is chosen.
Local Structural Coefficients
Name of the node Equal, Space or Tab value of the local structural coefficient or empty if we want to reset to the default value 1. The local structural coefficient is an empty string or a real number superior to 0. A node can be present only once otherwise the last occurrence is chosen.
State Virtual Numbers
Name of the node Equal, Space or Tab virtual number of states or empty if we want to delete an already existent number. The state virtual number is an empty string or an integer superior or equal to 2. A node can be present only once otherwise the last occurrence is chosen.
Locations
Name of the node Equal, Space or Tab , position. The location is represented by two real numbers separated by a Space . The first number represent the x-coordinate of the node and the second number the y-coordinate. A node can be present only once otherwise the last occurrence is chosen.
State
State Renaming
Name of the node or class dot (.) name of the state Equal, Space or Tab new state name or State name Equal, Space or Tab new state name if we want to rename the state for all nodes. The new name is a valid state name. A state can be present only once otherwise the last occurrence is chosen.
State Values
Name of the node or class dot (.) name of the state Space or Tab real value or Name of the state Equal, Space or Tab real value if we want to associate a value with a state whatever the node. The value is a real number. A state can be present only once otherwise the last occurrence is chosen.
State Long Names
Name of the node or class dot (.) name of the state Equal, Space or Tab long name or Name of the state Equal, Space or Tab long name if we want to associate a long name with a state whatever the node. The long name is a string. A state can be present only once otherwise the last occurrence is chosen.
Filtered States
Name of the node or class dot (.) name of the filtered state. Name of the filtered state if we want to set the filter property to the state whatever the node. A state can be present only once otherwise the last occurrence is chosen.
This screen is only available if you designated a Learning/Test variable in Step 2 — Definition of Variable Types.
Select the Learning/Test variable by clicking on its header or into the corresponding column.
Select BayesiaLab's learning and test labels from the drop-down lists to match the codes in your dataset.
Additionally, you can see the proportion of cases for each code in your dataset.
Given that you have a variable of the type Learn/Test, only the "learning" rows will be taken into account for Discretization and Aggregation. Otherwise, you would partially defeat the purpose of having a hold-out set.
BayesiaLab requires the discretization of all Continuous variables, and in this screen, you need to specify how to discretize those variables.
The Discretization process determines how a Continuous variable will be imported into BayesiaLab, i.e.,
the number of intervals (or bins);
the values of the thresholds which define the ranges of the intervals.
These attributes define the transformation of the underlying Continuous variable in the dataset into a discretized Continuous node in BayesiaLab.
To learn more about the important distinction between Continuous and Discrete nodes, please see these topics:
Continuous Nodes
Discrete Nodes
Select one or more Continuous variables and click into one of the headers or one of the corresponding columns.
The Discretization panel appears.
The first item in the Discretization panel is the Discretization Type drop-down menu.
The items on this list can be grouped into Automatic Discretization versus Manual Discretization.
The bottom item on the drop-down menu, Manual, refers to a Manual Discretization approach in which you have full control over thresholds, etc.
The remaining eleven items all refer to different kinds of Automatic Discretization.
However, even in Manual Discretization, you take advantage of the algorithms available with Automatic Discretization.
Manual Discretization
Automatic Discretization
Except for Manual, all items in the Type menu represent Automatic Discretization algorithms.
Selecting a Discretization algorithm applies variable by variable, i.e., you can use a different algorithm for each Continuous variable.
To select a variable, click on the variable header or anywhere inside the column.
You can perform the selection and deselection of multiple variables with keystroke combinations commonly used in spreadsheet editing:
Ctrl+Click: add a variable to the current selection.
Shift+Click: add all variables between the currently selected and the clicked variable to the selection.
Ctrl+A: select all variables in the Data panel. However, selecting all variables is not useful here in Step 4, as there are no actions that can apply to all variable types.
Shift+End: select all variables from the currently selected variable to the rightmost variable in the table.
Shift+Home: select all variables from the currently selected variable to the leftmost variable in the table.
Click the Select All Continuous button to select all Continuous variables.
Note that this action will also select any variables which you have already discretized manually. As a result, you may override your previous choices.
Note that Continuous variables already discretized manually are highlighted in soft blue.
If you do not specify an algorithm for a variable that was not manually discretized either, the default Discretization algorithm with its default settings will be used.
You can set the default Discretization algorithm under Main Menu > Window > Preferences > Discretization. [+] Show More
For the following algorithms, a Log Transformation is available as an option:
Applying the Log Transformation is useful if you have a high density of values at the bottom end of the variable domain. This "stretches" the scale for small values approaching zero.
Note that the Log Transformation is only used temporarily for discretization purposes. Thus, the values of the thresholds and values of the intervals can all be interpreted based on the original scale.
For the following algorithms, the option Isolate Zeros is available:
Separating 0 into a separate interval can be useful for zero-inflated distributions so as to clearly separate small values from "absolutely nothing."
Click Finish to perform the Discretization.
A progress bar displays the status of the Discretization process:
If a Filtered Value is defined for a Continuous variable, a new artificial interval with an infinitesimally small width of 10-7 will be added after the intervals defined in this step. This newly-created state will serve as the Filtered State, and "*", i.e., the asterisk character, will be its State Name.
At its conclusion, BayesiaLab opens up a Graph Window with all imported variables now represented as nodes.
The Discretization screen is part of within the .
This screen is only available if you designated at least one Continuous variable in .
At the bottom of the screen, the Data panel carries over from , although now without any options.
Automatic Discretization covers numerous discretization algorithms that are part of of the .
Most of these algorithms can also be accessed via the function within the screen.
Simultaneously, a window pops up that offers you an optional , which is of the .
The R2-GenOpt algorithm utilizes a Genetic Algorithm to find a discretization that maximizes the R2 between the discretized variable and its corresponding (hidden) Continuous variable.
As such, it is the optimal approach for achieving the first objective of discretization, i.e., finding a precise representation of the values of a Continuous variable.
This algorithm takes into account the Minimum Interval Weight and can also create a specific bin for representing zeros if the Isolate Zeros option is set.
In Validation Mode, the R2 value between the Discretized variable and its corresponding Continuous variable can be retrieved in the Information Mode by hovering over the monitor.
R2-GenOpt* is a modified version of R2-GenOpt and uses a specific MDL score to choose the number of bins.
With 100 observations, even though we selected 8 bins, only 3 were created for the variable 8- Wrist girth.
With 1,500 observations, even though we selected 10 bins, only 5 have been created for AGN, and 6 for ALL.
R2-GenOpt is one of the algorithms for Continuous variables in of the .
R2-GenOpt* is one of the algorithms for Continuous variables in of the .
Equal Distance is one of the Automatic Discretization algorithms for Continuous variables in Step 4 — Discretization and Aggregation of the Data Import Wizard.
The Equal Distance algorithm computes the equal distances based on the range of the variable.
This method is particularly useful for discretizing variables that share the same variation domain (e.g. satisfaction measures in surveys).
Additionally, this method is suitable for obtaining a discrete representation of the density function.
However, the Equal Distance algorithm is extremely sensitive to outliers and can generate intervals that do not contain any data points. Please see the Normalized Equal Distance algorithm, which addresses this particular issue.
Unlike the Discretization step, which is mandatory for Continuous variables, Aggregation is optional for Discrete variables.
Note that an analogous function, Generate Aggregations, is also available for Discrete nodes in the States tab of the Node Editor.
This function is useful when dealing with a large number of values in a Discrete variable. Once imported, the large number of resulting Node States would make it difficult to discover any relationships with that node.
The Aggregation function in the Data Import Wizard is available for single Discrete variables and for multiple Discrete variables.
Please see the usage instructions and examples in the corresponding sub-topics:
Aggregation of Single Variable
Aggregation of Multiple Variables
Unsupervised Multivariate is one of the Automatic Discretization algorithms for Continuous variables in Step 4 — Discretization and Aggregation of the Data Import Wizard.
This multivariate discretization method is based on analyzing the relationship between variables.
The Unsupervised Multivariate discretization algorithm focuses on representing multivariate probabilistic dependencies using Random Forests.
Its functionality can be described as follows:
A new dataset is created as a clone of the original one.
In this new dataset, each variable is independently shuffled to render all the variables independent while keeping the same statistics for each variable.
The cloned dataset is concatenated with the original dataset. Then, a target variable is created to differentiate the clone from the original, indicating the independent set versus the original dependent set.
Various datasets are generated from this concatenated dataset with Data Perturbation.
For each perturbed dataset, a multivariate tree is learned to predict the target variable with a subset of variables. If a structure is already defined, it is used to bias the selection of the variables for each dataset.
Extracting the most frequent thresholds produces the discretization.
Being based on Random Forests, this algorithm is computationally expensive and stochastic by nature, specifically when the number of variables is important.
The Unsupervised Multivariate discretization algorithm is also available after the data import via Main Menu > Learning > Discretization
.
However, it is not available in the Node Editor (Node Context Menu > Edit > Curve > Generate a Discretization
).
Density Approximation is one of the Automatic Discretization algorithms for Continuous variables in Step 4 — Discretization and Aggregation of the Data Import Wizard.
The Density Approximation discretization detects changes in the sign of the derivative of the Probability Density Function (PDF) in order to identify local minima and maxima.
Between each local minimum and maximum, the algorithm creates a threshold.
Also, the algorithm automatically detects the optimal number of bins, although you can specify the maximum number of bins.
The minimum size permitted for bins is 1% of the data points.
To illustrate all related workflows, we use an American auto buyer satisfaction survey containing 42,397 responses. Each record contains attributes of the purchased vehicle, such as make (or brand), model, body style, vehicle segment, number of cylinders, transmission, price paid, self-reported fuel economy, plus hundreds of other variables.
First, we want to manually aggregate all 37 automobile brands that appear in the survey into just two states, i.e., Premium Brands and Non-Premium Brands.
This manual aggregation will be based exclusively on our subjective perception of the auto industry as of 2009, which is when this particular survey was conducted.
Click on the Brand variable in the Data panel.
From the States list on the left, select the values you wish to aggregate using Shift+Click or Ctrl+Click.
Then, click the Aggregate button.
The newly-formed, aggregated state appears in the Aggregates list on the right.
By default, the original values are concatenated using the "+" symbol as a delimiter. An underscore "_" is added as a prefix.
As necessary, you can select more values from the States list and create additional aggregated states.
In the list of Aggregates, you can now replace the automatically-generated state names with more meaningful ones.
You can now proceed to any other variable or click Finish to conclude the Data Import Wizard.
Continuing with the previous example, we now perform an aggregation of the same variable, Brand. Now, however, we use each brand's correlation with Price as a guide instead of our judgment.
For the purpose of this demonstration, we have already discretized the Price variable manually into three (arbitrary) intervals using two thresholds, i.e., $25,000 and $45,000.
We now want to use the correlation of each brand with the top interval, i.e., $45,000+, as a measure of its "premium appeal" so that we can reduce the 37 brands into three states, Mainstream, Premium, and Luxury.
For reference, 8.65% of all survey responses reported a vehicle purchase price of $45,000 or higher.
Click on the Brand variable in the Data panel.
Click the Show Correlations box.
Select Target and State.
Review the values shown in the Correlations column. By hovering with your cursor over the Correlation bars in each row, a Tooltip displays the percentage difference of the corresponding row versus the marginal value.
The colored bars show how each value compares to the marginal probability of the selected state of the target. A green-colored bar indicates a probability higher than the marginal probability, and a red bar suggests a lower probability.
Select the states to aggregate using Ctrl+Click.
Once you have selected the values, click the Aggregate button.
The newly aggregated values now appear as a single item in the Aggregates list.
Review the newly aggregated states and, if necessary, assign new names to replace the ones that were generated automatically.
To reverse the aggregation select the aggregated items in the Aggregates list and click Delete.
The principal difference is that you don't select your to-be-aggregated values manually but rather specify thresholds that determine the aggregation.
Click on a Discrete variable in the Data panel.
Click the Show Correlations box.
Select Target and State.
Review the values shown in the Correlations column. By hovering with your cursor over the Correlation bars in each row, a Tooltip displays the percentage difference of the corresponding row versus the marginal value.
The colored bars show how each value compares to the marginal probability of the selected state of the target. A green-colored bar indicates a probability higher than the marginal probability, and a red bar suggests a lower probability.
Now, instead of manually selecting the values you want to aggregate, click the Automatic Aggregation button.
The Automatic Aggregation window opens up.
The colored bar at the top visualizes the percentage differences versus the marginal probability of the selected state of the target.
In our example, there is one brand, Mercury, which had no observations in the $45,000+ interval. As a result, it marks the bottom end of the spectrum, i.e., it is 8.65 percentage points below the marginal probability.
On the other end of the spectrum, Porsche is 83.97 percentage points above the marginal probability.
A default threshold is shown for 0, which is marked by the pink-to-red color change in the bar.
You can manually add thresholds by right-clicking on the bar.
As soon as you add a threshold, a corresponding entry appears in the list below.
Right-clicking again on an existing threshold removes that threshold.
You can move an existing threshold by clicking on it and then dragging it to the desired value.
Also, in the table below the colored bar, you can type in a threshold value.
By clicking OK, you confirm the specified thresholds, and all values in the States list will be aggregated accordingly.
Alternatively, you can click on Generate Aggregates and specify the desired number of intervals.
You obtain a set of aggregation thresholds, which you can further modify or accept by clicking OK.
Now you have a new set of states in the list of Aggregates.
The Normalized Equal Distance algorithm pre-processes the data with a smoothing algorithm to remove outliers before computing equal partitions.
As a result, the algorithm is less sensitive to outliers than the Equal Distance algorithm.
The algorithm also takes into account the Minimum Interval Weight that defines the minimum prior probability of a bin.
You can adjust the default Minimum Interval Weight under Main > Menu > Window > Preferences > Discretization
.
We use the same auto buyer survey dataset to illustrate the process. In the auto industry, numerous schemes are used to group vehicle types and body styles into so-called segments. Each segment carries a descriptive name, e.g., Compact Car, Full-Size SUV, Minivan, Mid-Size Pickup, Mid-Size Crossover. In our dataset, we have four variables, which each represent such a segmentation scheme. While all these segmentation schemes roughly convey the same information, they differ in their granularity: for instance, variable Segmentation 3 has 23 states; Segmentation 4 has 33. Our objective is now to reduce each one of the segmentation schemes down to three states.
This time, instead of Price, we use the variable MPG - Combined as a target. It represents the survey respondents' estimates of their vehicles' combined fuel economy in miles per gallon (MPG). In other words, we want to create a new aggregation for each segmentation scheme based on fuel economy. Also, the variable MPG - Combined only has two intervals, with one threshold at 22.5. This number has been used in the past as a criterion for so-called "gas guzzlers." So, we are going to use the state <=22.5 as a proxy for poor fuel economy. As a result, we expect each of the existing segments to be "remapped" according to fuel economy.
In the Data panel, using Ctrl+Click or Shift+Click, select the variables Segmentation 1, Segmentation 2, Segmentation 3, and Segmentation 4.
This brings up the Multiple Aggregation panel.
Set Target to MPG - Combined, and State to <=22.5.
Set Final Number of States to 3.
Click the Aggregate button to perform the aggregation.
Note that there will be no immediate feedback regarding the results of the aggregation.
Rather, we can only see the results of the aggregation in the Import Report in Step 5 of the Data Import Wizard.
Click Finish to complete Step 4 of the Data Import Wizard.
BayesiaLab opens a new Graph Window with all variables now presented as nodes.
Simultaneously, a prompt comes up offering to display the Import Report.
Click Yes, and the Import Report — featuring all variables, not just the aggregated variables — appears in a new window.
This Equal Frequency algorithm defines thresholds so that each interval contains the same number of observations.
This approach typically produces a uniform distribution.
As a result, the shape of the original density function is no longer apparent upon discretization.
This also leads to an artificial increase in the entropy of the system, directly affecting the complexity of machine-learned models.
However, this type of discretization can be useful — once a structure is learned — for further increasing the precision of the representation of continuous values.
Individual variables can be aggregated manually or automatically in .
In addition to the described above, BayesiaLab can support you in making the aggregation decisions. For this purpose, BayesiaLab can show how the original values of the to-be-aggregated variable correlate with those of other variables.
The Correlation-Aided Automatic Aggregation is very similar to the .
So, the initial steps are analogous to the .
Normalized Equal Distance is one of the algorithms for Continuous variables in of the .
Similar to the workflow for the , you can also perform an Aggregation of Multiple Variables.
Equal Frequency is one of the algorithms for Continuous variables in of the .
The Import Report is the fifth and final step of the Data Import Wizard.
After you click Finish in Step 4 of the Data Import Wizard, two progress bars inform you about the status:
Depending on the size of your dataset, the selected discretization algorithms, and the number of Missing Values, this may take anywhere from a fraction of a second to several minutes.
Once completed, BayesiaLab opens up a new Graph Window with all imported variables now represented as nodes.
At the same time, a prompt appears, offering you the Import Report.
Note that this report is entirely optional. So whether you display it or not does not affect the completion of the Data Import Wizard.
Click Yes to bring up the Import Report window.
The first column displays the names of the imported variables.
The second column displays the type associated with each variable.
For a Weight variable, no further information is available or provided.
For a Learn/Test variable, the association with BayesiaLab's Learn and Test labels is shown, plus the corresponding number of cases.
The third column shows all States of each variable, if applicable.
The right part of the report depends on the variable type:
Discrete Variables:
The report shows each state and, adjacent to it, any aggregations that were performed. Furthermore, the color of the rightmost cell in the row highlights that an aggregation took place.
Continuous Variables:
The names of the discretized states are shown.
The next two columns to the right report the lower and upper thresholds for each interval.
The rightmost column is colored according to the discretization algorithm used.
Asked/Obtained indicates the requested discretization algorithm versus the one that was used as the fallback option.
Note that you can save this Import Report as an HTML file, so you can subsequently open the fully-formatted report in Excel or any other spreadsheet software.
BayesiaLab offers learning algorithms that allow you to generate a Bayesian network from data.
However, with a given Bayesian network, BayesiaLab can also generate data.
Select Main Menu > Data > Generate Data
.
It is possible to choose to generate the data as an internal database. We can also indicate the rate of missing values of the base and use the long name of the states if the database is written in a file. It is possible to generate a database with test examples by indicating the wanted percentage.
BayesiaLab can load data from flat text files (e.g., CSV, TXT) or connected databases.
To launch the Data Association Wizard for a data table in a
text file, select Main Menu > Data > Open Data Source > Text File
.
database, select Main Menu > Data > Open Data Source > Database
.
See Step 1 of the Data Import Wizard
See Step 2 of the Data Import Wizard.
Additionally, clicking the Unmatched Columns button displays all the columns in the database that are not in the network.
The Unmatched Columns window allows you to select whether to use or not use the unmatched columns from the new dataset.
This step links the variables in the dataset to the nodes of the network.
As such, this step depends on the three previous steps and the selection of variable types.
Here you can define how the variables in the to-be-associated dataset will be mapped to the nodes already in the network.
The following assignments are possible:
Discrete variable in the dataset → Discrete node in the network
Discrete variable in the dataset → Continuous node in the network
Continuous variable in the dataset → Continuous node in the network
If variables in the dataset have the same name and type as existing nodes in the network, BayesiaLab will automatically propose an association.
You can process in the same way for the continuous node N. You can also select and add several nodes at the same time.
The zone 3 contains the buttons used to add or remove associations.
The zone 4 contains the list of associations. It can contain also added variables from the database that will be treated as new nodes in the network. A double-click on an association display, if necessary, a dialog used to edit a discrete or a continuous association. As you can see, some associations show a warning icon. This icon indicates that some unusual behaviors are present in those associations.
The zone 6 contains three buttons. The first and second buttons allow extending automatically the minimum and maximum of each continuous node that does not fit the database's limits. The third button allows filtering automatically each row that does not fit the network's limits.
When you want to add or edit an association between a discrete column of the database and a discrete or continuous node, a dialog box appears:
The zone 3 contains the buttons to add or remove states' associations.
By default, the database's states which are the same as the network's ones, as the aggregates or as the states' long names will be automatically linked.
If filtered values exist in the database but are not declared in the network, it is possible to merge them with the specific state *, if it exists. In this case, this state will be automatically defined as filtered for each concerned node.
When you want to add or edit an association between a continuous column of the database and a continuous node, a dialog box appears:
This dialog is displayed only if the limits of the variable from the database are outside the limits of the node from the network.
By default, the limits of the node of the network are used and all the values outside these limits will be removed from the database. If you want to keep them, use the corresponding options.
If filtered values exist in the database but are not declared in the network, it is possible to merge them with the specific state *, if it exists. In this case, this state will be automatically defined as filtered for each concerned node.
This step occurs only when some columns of the database are not linked with nodes of the network but are distributed. These columns will create new nodes in the network and must be discretized if they are continuous and their states can be aggregated if they are discrete.
Same as Step 4 in Data Importation Wizard.
The modified nodes table:
For the discrete nodes, will be indicated, if necessary, the correspondence between the states in the database and in the network.
For the continuous nodes, will be indicated, if necessary, the initial minimum of the data and the retained final minimum and also the initial maximum and the retained final maximum.
The hidden nodes table: indicates the node that are in the network and that don't have any associated data.
The added nodes table: indicate the list of variables added to the network from the database. This table is the same as in the import report
Data Discretization:
Dataset Creation:
Missing Values Estimation:
For this purpose, BayesiaLab draws samples from the encoded by the Bayesian network and saves the obtained samples as observations.
The states' long name can be saved instead of the states' name. If the user wants to save the continuous values, the numerical values will be created randomly in each interval. If the data are generated in , then the evidence is considered.
brings data into BayesiaLab to create a new Bayesian network, while Associate Data Source (Data Association Wizard) adds new data to a pre-existing network.
There are a total of six steps in the Data Association Wizard, which are mostly identical to the steps in the .
See
See
See
The zone 1 contains the list of the variables contained in the database and not already associated to a node of the network or added as a new node of the network. As you can see, the variable Geographic Zone contained in the database is discrete and has no corresponding node in the network. If you want to add it as a new node, select it and click on the button , otherwise, if you don't want to add it, do nothing.
The zone 2 contains the list of the nodes contained in the network and not already associated to a column of the database. If you want to link a variable from the database to a node of the network, simply select each one and press the button . All remaining nodes in this list will not be linked to a column of the database and will be considered as hidden node in the network.
The zone 5 contains a list containing the details of each warning of associations located in zone 4. If you select a warning in the list, the corresponding association will be selected in the zone 4. When the mouse hovers on the list, a tooltip shows the content of the warning. A double-click on it opens the convenient association editor in order to verify or modify the association. If you want to remove an asso- ciation or an added node, select it in the list and press the button .
The zone 1 contains the list of the states from the database that are not already linked to a state of the node or directly added as a new state. To perform an association, select a state in the zone1 and a state in the zone 2 and press . If you want to add a state without linking it to a state of the node, simply select it and press the button .
The zone 2 contains the list of the states from the node of the network. This list will never be modified. Even if an association is done, the corresponding state of this list will not be removed and can be reused for another association. It allows linking several states from the database to the same state of the node from the network. To perform an association, select a state in the zone1 and a state in the zone 2 and press . The state from the zone 1 will be removed and the association will be added in the zone 4.
The zone 4 contains all the associated and added states. An association can be removed by selecting it in the list and pressing the button .
After association, the dialog looks like: If there are still some states not linked in zone 1, these states will be removed from the database.
After successful data import, it is possible to display the HTML associate report. This report may contain three tables:
Dictionaries offer a convenient way to manage a large set of properties related to a Bayesian network using text files with a human-readable syntax.
Dictionaries are plain text files that can be opened and edited outside of BayesiaLab in any text editor.
Using Dictionaries, you can export the properties of a given network or associate properties that you previously saved.
Dictionaries are specific to the elements of a Bayesian network, e.g., Arcs, Nodes, and States and their respective properties.
To associate a Dictionary for Arc properties, select
Main Menu > Data > Associate Dictionary > Arc >
and then select the property from the submenu:
Dictionary File Structure
As indicated by the syntax, the name of the node, class or state in the text file cannot contain equal, space or tab characters. If the node names contain such characters in the networks, those characters must be written with a {color} (backslash) character before in the text file: for example the node named Visit Asia will be written Visit\ Asia in the file.
In order to specifically differenciate a nam which is the same for a classe, a node or a state, you must add at the end of the name the suffix "c" for a class, "n" for a node and "s" for a state.
If your network contains non-ASCII characters, you must save your own dictionaries with UTF-8 (Unicode) encoding. For example, in MS Excel, choose "save as" and select "Text Unicode (*.txt)" as type of file. In Notepad, choose "save as" and select "UTF-8" as encoding. If your file contains only ASCII character you can let the default encoding (depending on the platform) but it is strongly encouraged to use UTF-8 (Unicode) encoding in order to create dictionary files that doesn't depend on the user's platform. So, for example, a chinese dictionary can be read by a german without any problem whatever the used platforms are. If you are not sure how to save a file with UTF-8 encoding, you should export a dictionary with BayesiaLab, modify and save it (with any text editor) and load it in BayesiaLab.
Node Renaming: allows renaming each node with a new name. These new names must be, of course, all different.
Comments: allows associating a comment with each node that is in the file.
Classes: allows organizing nodes in subsets called classes . A node can belong to several classes at the same time. These classes allow generalizing some node's properties to the nodes belonging to the same classes. They allow also creating constraints over the arc creation during learning.
Colors: allows associating colors with the nodes or classes that are in the file. The colors are written as Red Green Blue with 8 bits by channel in hexadecimal format (web format): for example the color red is 255 red 0 green 0 blue, it will give FF0000. Green gives 00FF00, yellow gives FFFF00, etc.
Images: allows associating colors with the nodes or classes that are in the file. The images are represented by their path relatively to the directory where the dictionary is.
Costs: allows associating with each node a cost . A node without cost is called not observable.
Temporal Indices: allows associating temporal indices with the nodes that are in the file. These temporal indexes are used by the BayesiaLab's learning algorithms to take into account any constraints over the probabilistic relations, as for example the no adding arcs between future nodes to past nodes. The rule that is used to add an arc from node N1 to node N2 is:
If the temporal index of N1 is positive or null, then the arc from N1 to N2 is only possible if the temporal index of N2 is greater of equal to the index of N1.
Local Structural Coefficients: allows setting the local structural coefficient of each specified node or each node of each specified class.
State Virtual Numbers: allows setting the state virtual number of each specified node or each node of each specified class.
Locations: allows setting the position of each node.
To associate a Dictionary for Arc properties, select
Main Menu > Data > Associate Dictionary > Arc >
and then select the property from the submenu:
Arcs
Specifies the addition or removal of arcs for the currently active Bayesian network. If an arc removal is specified, it will precede any addition of an arc.
Before adding arcs, any constraints applicable to the active Bayesian network and the Temporal Indices will be checked. If a specified arc addition is inconsistent with the existing constraint, the arc won't be added.
Syntax Examples:
N1->N2=
true
adds an arc from N1 to N2
N1->N2=
false
removes the arc from N1 to N2
N1<-N2=
true
adds an arc from N2 to N1 (note the reversal of the arrow symbol <-
produces an arc in the opposite direction).
Note that you need to add an escape character \
before any spaces in node names. Otherwise, a space will be interpreted as a delimiter:
N\ 1->Node\ 2=
true
adds an arc from N 1 to N 2
Instead of the ->
characters, you can also use space
, the equal sign =
, and --
as a delimiter between the start node and end node. With these alternative delimiters, the order of the nodes determines the arc direction.
N1 N2=
true
adds an arc from N1 to N1
N1=N2=
true
adds an arc from N1 to N2
N1--N2=
true
adds an arc from N1 to N2
N1 N2=
true
adds an arc from N1 to N2
Forbidden Arcs
Specifies the addition or removal of Forbidden Arcs between nodes and classes
Syntax Examples:
N1->N2
adds a Forbidden Arc from N1 to N2
N1--N2
adds a Forbidden Arc between N1 and N2
ClassA->ClassB
applies Forbidden Arcs from any nodes in ClassA to any nodes in ClassB
N1
N2
removes any existing Forbidden Arc between N1 and N2. Note the space in the syntax, which triggers the removal of the Forbidden Arc.
Arc Comments
Adds, updates, or removes Arc Comments to arcs in the active network. Arc Comments are stored in HTML format.
Syntax Examples:
N1->N2=<p>This is a sample <b>Arc Comment</b>.</p>
adds an Arc Comment to the arc between N1 and N2.
N1->N2=
removes an existing Arc Comment from the arc between N1 and N2.
The added Arc Comment can be edited in the Arc Editor: Arc Contextual Menu > Edit
Arc Colors
Defines colors for arcs in the active network. You can specify the color for each arc individually by providing the hex code of the color
Syntax Examples:
N1->N2=000000
changes the color of the arc between N1 and N2 to black.
N1->N2=FF0000
changes the color of the arc between N1 and N2 to bright red.
Note that there is no option to revert an arc color to the default color. When changing Arc Colors via a Dictionary, the colors must always be specified explicitly.
Structural Priors
Assigns Structural Priors to arcs in the active network.
Fixed Arcs
Applies Fixed Arcs to the active network or removes them.
Syntax Example:
N1->N2=true
changes the arc between N1 and N2 to a Fixed Arc.
N1->N2=false
changes the arc between N1 and N2 to a normal, non-fixed arc.
State:
State Renaming: allows renaming each state of each node with a new name.
State Values: allows associating with each state of each node a numerical value .
State Long Names: allows associating with each state of each node a long name more explicit than the default state name. This name can be used in the different ways to export a database, in the html reports and in the monitors.
Filtered States: allows defining a state to each node as a filtered state .
A saved Evidence Scenario File can be reimported into the network from where it originated (e.g., after external modification, see Evidence Scenario File Syntax) or it can be loaded into an entirely different network file.
Main Menu > Data > Evidence Scenario File > Associate
.
If the newly-associated Evidence Scenario File contains incompatible content, e.g., nonexistent nodes in the network, BayesiaLab shows a corresponding error message:
However, the remaining, compatible content will be available in the now-attached Evidence Scenario File.
In BayesiaLab, you can manage sets of actual or potential observations in a Bayesian network using Evidence Scenario Files.
For instance, an Evidence Scenario File can serve as a convenient way to manage multiple sets of assumptions, such as what-if scenarios. This is particularly helpful when scenarios contain many individual assumptions. Imagine the business case of an airline represented as a Bayesian network. It would have to include assumptions regarding travel demand for all origin-destination pairs. Manually setting and modifying assumptions for hundreds of nodes would not be practical.
An Evidence Scenario File consists of one or more Evidence Scenarios.
And, each Evidence Scenario contains one or more node-specific observations, as illustrated below:
Applying an Evidence Scenario means setting the stored pieces of evidence to the corresponding nodes.
Note that evidence cannot be set on Not Observable Nodes, i.e., nodes that have a Cost of 0 (see Cost Management).
With a given Bayesian network, any current observation on a node or sets of observations set on multiple nodes can be recorded as an Evidence Scenario. As soon as you store an Evidence Scenario, BayesiaLab "starts a tab" by creating an internal Evidence Scenario File.
Four types of evidence can be saved as an Evidence Scenario:
Hard Evidence
Likelihood Evidence
Probabilistic Evidence
Numerical Evidence
To learn more about setting evidence, please see the section on Setting Evidence in Contextual Menu of Monitors.
Then, enter an optional comment in the pop-up window and assign a Weight to the Evidence Scenario you are storing. If you don't enter a comment, the Evidence Scenario will merely be indexed sequentially, starting with 0.
Click OK to confirm.
You can add further Evidence Scenarios to the ones already stored in the internal Evidence Scenario File.
Upon selecting (and therefore applying) an Evidence Scenario, the corresponding comment, if available, appears in the Status Bar.
Note that an Evidence Scenario File is saved with the Bayesian network file. So, reopening the saved network makes all stored Evidence Scenarios available again.
In addition to recalling Evidence Scenarios one by one, you can also use them in BayesiaLab batch-processing functions:
Batch Labeling
Batch Inference
Batch Joint Probability
Batch Outlier Explanation
In this context, the Evidence Scenario File provides the observations in the same way as an internal or external dataset.
In Modeling Mode, you can conduct all modeling activities, such as learning and editing network graphs.
In Modeling Mode, only the Graph Panel is visible and accessible inside the Graph Window, i.e., the Graph Panel fills the Graph Window entirely.
There are several ways to switch to Modeling Mode:
Press the shortcut F4
.
Select Main Menu > View > Modeling Mode
.
In Validation Mode, you can perform network validation, simulation, and analysis.
In Validation Mode, both the Graph Panel and the Monitor Panel are displayed in the Graph Window.
There are several ways to switch to Validation Mode:
Press the shortcut F5
.
Select Main Menu > View > Validation Mode
.
Dictionary File Structures | ||
---|---|---|
To store an observation as an Evidence Scenario, click the icon.
Now, an additional icon in the Status Bar indicates that there is an Evidence Scenario File.
Right-clicking the icon in the Status Bar brings up the list of stored Evidence Scenarios, enumerated by an index and, if available, with corresponding comments.
So, the next time to click the icon, the pop-up window asks whether you want to append the new Evidence Scenario to the list of Evidence Scenarios or replace a particular existing Evidence Scenario.
To apply (or recall) a stored Evidence Scenario, right-click on the Evidence Scenario File icon in the Status Bar and click on the scenario you want to apply to the network.
Also, hovering over the Evidence Scenario File icon with your pointer brings up the number of available Evidence Scenarios.
You can remove the current Evidence Scenario File by left-clicking on the icon.
The Graph Window can only be in one of two possible modes, i.e., and .
Click in the lower-left corner of the Graph Panel.
In any workflow with BayesiaLab, switching between and is very frequent. Hence, we highly recommend that new users start using the F4
and F5
shortcuts straight away.
The Graph Window can only be in one of two possible modes, i.e., and .
Click in the lower-left corner of the Graph Panel.
In any workflow with BayesiaLab, switching between and is very frequent. Hence, we highly recommend that new users start using the F4
and F5
shortcuts straight away.
Arc
Arcs
Name of the arc's starting node or class, -> , <- or even -- to indicate the both possible orientations, name of the arc's ending node or class, Equal, Space or Tab , true for an added arc or false for a removed arc. The last occurrence is always chosen.
Forbidden Arcs
Name of the arc's starting node or class, -> , <- or even -- to indicate the both possible orientations, name of the arc's ending node or class.
Comments
Name of the arc's starting node or class, -> , <- or even -- to indicate the both possible orientations, name of the arc's ending node or class, Equal, Space or Tab , comment . The comment can be any character string without return (in html or not). The last occurrence is always chosen.
Colors
Name of the arc's starting node or class, -> , <- or even -- to indicate the both possible orientations, name of the arc's ending node or class, Equal, Space or Tab , color . The color is defined as Red Green Blue 8 bits by channel color written in hexadecimal (web format). For example green gives 00FF00, yellow gives FFFF00, blue gives 0000FF, pink gives FFC0FF,etc. The last occurrence is always chosen.
Fixed Arcs
Name of the arc's starting node or class, -> , <- or even -- to indicate the both possible orientations, name of the arc's ending node or class, Equal, Space or Tab , true for an fixed arc or false for a not fixed arc. The last occurrence is always chosen.
Node
Node Renaming
Name of the node Equal, Space or Tab new node name. The new name must be valid (different from t or T and without?). A node can be present only once otherwise the last occurrence is chosen.
Comments
Name of the node or the class Equal, Space or Tab Comment. The comment can be any character string without return (in html or not). A node can be present only once otherwise the last occurrence is chosen.
Classes
Name of the node Equal, Space or Tab Name of the class. The class can be any character string. A node present several times will be associated with different classes.
Colors
Name of a node or a class Equal, Space or Tab Color The color is defined as Red Green Blue 8 bits by channel color written in hexadecimal (web format). For example green gives 00FF00, yellow gives FFFF00, blue gives 0000FF, pink gives FFC0FF, etc. A node can be present only once otherwise the last occurrence is chosen.
Images
Name of a node or a class Equal, Space or Tab path to the image relatively to the directory where the dictionary is. The image path must be a valid relative path or an empty string. A node can be present only once otherwise the last occurrence is chosen.
Costs
Name of the node Equal, Space or Tab value of the cost or empty if we want the node to be not observable. The cost is an empty string or a real number superior or equal to 1. A node can be present only once otherwise the last occurrence is chosen.
Temporal Indices
Name of the node Equal, Space or Tab value of the index or empty if we want to delete an already existent index The index is an integer. A node can be present only once otherwise the last occurrence is chosen.
Local Structural Coefficients
Name of the node Equal, Space or Tab value of the local structural coefficient or empty if we want to reset to the default value 1. The local structural coefficient is an empty string or a real number superior to 0. A node can be present only once otherwise the last occurrence is chosen.
State Virtual Numbers
Name of the node Equal, Space or Tab virtual number of states or empty if we want to delete an already existent number. The state virtual number is an empty string or an integer superior or equal to 2. A node can be present only once otherwise the last occurrence is chosen.
Locations
Name of the node Equal, Space or Tab , position. The location is represented by two real numbers separated by a Space . The first number represent the x-coordinate of the node and the second number the y-coordinate. A node can be present only once otherwise the last occurrence is chosen.
State
State Renaming
Name of the node or class dot (.) name of the state Equal, Space or Tab new state name or State name Equal, Space or Tab new state name if we want to rename the state for all nodes. The new name is a valid state name. A state can be present only once otherwise the last occurrence is chosen.
State Values
Name of the node or class dot (.) name of the state Space or Tab real value or Name of the state Equal, Space or Tab real value if we want to associate a value with a state whatever the node. The value is a real number. A state can be present only once otherwise the last occurrence is chosen.
State Long Names
Name of the node or class dot (.) name of the state Equal, Space or Tab long name or Name of the state Equal, Space or Tab long name if we want to associate a long name with a state whatever the node. The long name is a string. A state can be present only once otherwise the last occurrence is chosen.
Filtered States
Name of the node or class dot (.) name of the filtered state. Name of the filtered state if we want to set the filter property to the state whatever the node. A state can be present only once otherwise the last occurrence is chosen.
As with BayesiaLab's Dictionaries, the syntax of an Evidence Scenario File is straightforward. However, we need to distinguish between the syntax for Contemporaneous and Temporal networks:
Each line of an Evidence Scenario File represents one Evidence Scenario.
Encoding an Evidence Scenario always follows the same pattern, with the node name and the evidence separated by a colon (:). The optional scenario name follows after a double slash (//).
?<NodeName>?:<Evidence>//<ScenarioName>
Evidence can be encoded in several ways in an Evidence Scenario File:
Hard Evidence:
?<NodeA>?:<State1>//Scenario1
Numerical Evidence:
?<NodeB>?:m{<value>}//Scenario2
Probabilistic Evidence:
?<NodeC>?:p{<StateA>:0.3;<StateB>:0.5;<StateC>:0.2}//Scenario3
Likelihood Evidence:
?<NodeD?:l{<StateX>:1;<StateY>:0.5}//Scenario4
To encode multiple pieces of evidence in one Evidence Scenario, simply separate the individual pieces of evidence with a semicolon. The scenario name remains at the end of the line, separated by a double slash.
For Temporal Bayesian networks, the syntax of the Evidence Scenario File is slightly different. Here, each line in the text file refers to a time step, in which the evidence specified in that line will be applied.
Each line starts with an integer value that represents the time step, in which the evidence of that line will be set.
Evidence can be encoded in several ways in an Evidence Scenario File:
To encode multiple pieces of evidence in one Time Step, simply separate the individual pieces of evidence with a semicolon.
For Temporal networks, recalling evidence from the Evidence Scenario File is different compared to Contemporaneous networks.
Now, the time-specific Evidence Scenarios will be set automatically as you perform a temporal simulation.
Perturbed Tree is one of the Automatic Discretization algorithms for Continuous variables in Step 4 — Discretization and Aggregation of the Data Import Wizard.
The Perturbed Tree algorithm is designed to optimize the representation of the probabilistic dependency between a Target variable and the to-be-discretized variable. It is an extension of the Tree discretization algorithm, and it functions as follows:
Data Perturbation generates a range of datasets.
For each perturbed dataset, a univariate tree is learned to predict the Target variable with the to-be-discretized continuous variable.
Extracting the most frequent thresholds produces the final discretization.
The Perturbed Tree algorithm takes into account the Minimum Interval Weight and can reduce the number of bins if necessary. It can also be more robust than the simple Tree discretization.
Tree is a bivariate discretization method. It machine-learns a decision tree that uses the to-be-discretized variable for representing the conditional probability distributions of the Target variable given the to-be-discretized variable. Once the Tree is learned, it is analyzed to extract the most useful thresholds.
It is the method of choice in the context of Supervised Learning, i.e., if you plan to machine-learn a model to predict the Target variable.
At the same time, we do not recommend using Tree in the context of Unsupervised Learning. The Tree algorithm creates bins that are biased toward the designated Target variable. Naturally, emphasizing one particular variable would run counter to the intent of Unsupervised Learning.
Note that if the to-be-discretized variable is independent of the selected Target variable, it will be impossible to build a tree, and BayesiaLab will prompt you to select a univariate discretization algorithm.
All manually discretized variables can be used as a Target variable for Tree discretization.
Using a Target variable for Discretization does not create a Target Node in the network.
Select Manual from the drop-down menu.
Several additional items and buttons appear on the left side, plus a Cumulative Distribution Function (CDF) is shown on the right. This CDF plot can help in selecting appropriate discretization intervals.
In the screenshot below, the variable Standing Height (cm) is selected, meaning that the CDF plot corresponds to that variable.
Click on the Density Function button, and the Probability Density Function (PDF) of the same variable appears.
Now the button reads Distribution Function, and by clicking it, you can toggle back to the CDF view.
By default, only one threshold is placed at the mean value of the corresponding variable.
This threshold appears as a horizontal line on the CDF and a vertical line on the PDF.
The CDF and PDF plots are interactive; you can add, delete, and modify thresholds.
The following instructions apply to both plots:
To select a threshold, left-click on that threshold.
The selected threshold is highlighted in red.
The remaining thresholds on the plot remain blue.
The precise numerical value of a selected threshold is shown in the Threshold Value field to the right of the plot.
To move a threshold, click on it and hold, then move it. Release to fix its position.
The percentages displayed at the end of a selected threshold refer to the share of observations that fall into the intervals above and below this threshold.
Instead of moving the selected threshold with your cursor, you can type a specific value into the Threshold Value field.
To add an additional threshold, right-click with your cursor on the desired position.
To remove an existing threshold, right-click on it to delete it.
A zoom function is available for examining the plot in detail:
Hold the Ctrl
key, click and hold the left mouse button, then move the cursor across the range you wish to focus.
To revert to the default zoom, hold Ctrl
, then double-click anywhere in the plot area.
You can zoom in repeatedly until you have reached the desired magnification level.
As an alternative to selecting a threshold by left-clicking, you can scroll through all thresholds using the Previous and Next buttons.
Note that as soon as a threshold is defined on a Continuous variable, it is considered Discretized, and the variable's data column is colored in soft blue.
The interactive CDF and PDF plots are similar to the editing functions available under Curve View in the Node Editor.
We re-use the dataset from the previous steps, so we can fast-forward to Step 4 and focus on that step.
While remaining on the Manual Discretization screen, you can also utilize the Generate a Discretization function.
Click on the Generate a Discretization button.
Then, select the Type from the drop-down menu, e.g., the R2-GenOpt algorithm. You have nine algorithms available, i.e., the univariate methods only.
Choose the number of Intervals, e.g., 5.
Set a Minimum Interval Weight, which defines the minimum prior probability of an interval in percent. The default value is 1%.
Note that you can set defaults for the above settings under Main Menu > Window > Preferences > Discretization
.
Additionally, there are options for Log Transformation and Isolate Zeros, which we discuss in the context of Automatic Discretization.
Click OK to perform the Discretization.
Select the source variable from which you wish to copy the thresholds.
Click the Transfer the Discretization Thresholds button.
A new window opens up that allows you to select one or more target variables.
Select the target variables.
Click OK.
This checkbox is synchronized across Manual and Automatic Discretization processes.
If checked, BayesiaLab automatically creates Classes for each type of Discretization, i.e., all variables that are discretized with the same algorithm will belong to the same Class.
Note that variables that were discretized manually, even if you used the Generate a Discretization button, will all become members of the Class MANUAL.
You can review the Class memberships in the Class Editor after the data import process is complete.
This function allows you to load a Discretization Dictionary with saved Discretization Intervals and Discretization Methods.
This approach is particularly helpful when you repeatedly import datasets with the same variables for which you have already found a suitable discretization.
The following text file illustrates the syntax of a Discretization Dictionary.
Tree is one of the algorithms for Continuous variables in of the .
Manual Discretization is one type of Discretization available in of the Data Import Wizard.
It allows you to use the algorithms from but in a more controlled environment where you can closely observe the results of the Discretization.
In certain situations, you may carefully choose thresholds for a variable (see ). Perhaps another variable, or multiple variables, should have exactly the same discretization. In this context, you can use the Transfer the Discretization Thresholds button.
Discretization Dictionary |
Supervised Multivariate is one of the Automatic Discretization algorithms for Continuous variables in Step 4 — Discretization and Aggregation of the Data Import Wizard.
The Supervised Multivariate discretization algorithm focuses on representing the multivariate probabilistic dependencies involving a Target variable.
It utilizes Random Forests to find the most useful thresholds for predicting the Target variable.
Its function can be summarized as follows:
Data Perturbation generates a range of datasets.
For each perturbed dataset, a multivariate tree is learned to predict the Target variable with a subset of variables. If a structure is already defined, it is used to bias the selection of the variables for each dataset.
Extracting the most frequent thresholds produces the final discretization.
The Supervised Multivariate takes into account the Minimum Interval Weight and can improve the generalization capability of the model.
Being based on Random Forests, this algorithm is computationally expensive and stochastic by nature.
After the conclusion of the Data Import Wizard, the Supervised Multivariate discretization algorithm is also available from Main Menu > Learning > Discretization
.
Not that the Supervised Multivariate discretization algorithm is not available via Node Context Menu > Node Editor > States > Curve > Generate a Discretization
.
When working with multiple networks that contain the same nodes, or at least some of the same nodes, it can be useful to share an Evidence Scenario File between them as well.
For that purpose, you can export an Evidence Scenario File and subsequently associate it with another network or be used with a WebSimulator.
Main Menu > Data > Evidence Scenario File > Export.
Then choose a file name and click Save.
The Evidence Scenario File is now saved in a human-readable and easily editable text format.
This allows you to modify the Evidence Scenario File with a text editor, e.g., to add a number of new Evidence Scenarios.
Please see the sub-topic Evidence Scenario File Syntax for a detailed discussion of the format.
K-Means is one of the Automatic Discretization algorithms for Continuous variables in Step 4 — Discretization and Aggregation of the Data Import Wizard.
The K-Means algorithm is based on the classical K-Means data clustering algorithm but uses only one dimension, which is the to-be-discretized variable.
K-Means returns a discretization that directly depends on the Probability Density Function of the variable.
More specifically, it employs the Expectation-Maximization algorithm with the following steps:
Initialization: random creation of K centers
Expectation: each point is associated with the closest center
Maximization: each center position is computed as the barycenter of its associated points
Steps 2 and 3 are repeated until convergence is reached.
Based on the centers K, the discretization thresholds are defined as:
The following figure illustrates how the algorithm works with K=3.
For example, applying a three-bin K-Means Discretization to a normally distributed variable would create a central bin representing 50% of the data points and one bin of 25% each for the distribution's tails.
Without a Target variable, or if little else is known about the variation domain and distribution of the Continuous variables, K-Means is recommended as the default method.