The Library

- Algorithms
- API Wrappers
- Bayesian Nets
- Compression
- Containers
- Graph Tools
- Image Processing
- Linear Algebra
- Machine Learning
- Metaprogramming
- Miscellaneous
- Networking
- Optimization
- Parsing

Help/Info

- Examples: C++
  - Assignment_Learning
  - Base64_Encoder
  - Bayesian_Network
  - Bayesian_Network_From_Disk
  - Bayesian_Network_GUI
  - Bridge
  - BSP
  - Cmd_Line_Parser
  - Compress_Stream
  - Config_File_Reader
  - Custom_Trainers
  - Directory_Navigation
  - Empirical_Kernel_Map
  - Graph_Labeling
  - GUI
  - HTTP_Server
  - Image
  - IO Socket Streams
  - IO Streams Server
  - Kernel_Centroid
  - Kernel_K-Means_Clustering
  - Kernel_Ridge_Regression
  - Kernel_RLS_Filtering
  - Kernel_RLS_Regression
  - KRR_Classification
  - Linear_Manifold_Regularizer
  - Logger
  - Logger_Advanced
  - Matrix
  - Matrix_Expressions
  - Member_Function_Pointer
  - Model_Selection
  - Multiclass_Classification
  - Multithreaded_Object
  - Neural_Network
  - Non-Linear Least Squares
  - Numerical_Integration
  - Object_Detector
  - Object_Detector_Advanced
  - One_Class_Classifiers
  - Online_SVM
  - Optimization
  - Parallel_For_Loops
  - Pipe
  - Pipe_2
  - Quantum_Computing
  - Queue
  - Rank_Features
  - Relevance_Vector_Classification
  - Relevance_Vector_Regression
  - Running_Stats
  - Sequence_Labeling
  - Sequence_Segmentation
  - Sockets
  - Sockstreambuf
  - Sparse_Vectors
  - Std_C++_Allocator
  - Structural_Support_Vector_Machines
  - Support_Vector_Machine
  - Support_Vector_Regression
  - SURF
  - SVM-Rank
  - Threaded_Object
  - Threads
  - Thread_Function
  - Thread_Pool
  - Timer
  - Train_Object_Detector
  - Using_Custom_Kernels
  - XML_Parser
- Examples: Python
  - Linear_Assignment_Problems
  - Sequence_Segmenter
  - Structural_Support_Vector_Machines
  - SVM-Rank
- FAQ
- Home
- How to compile
- How to contribute
- Index
- Introduction
- License
- Python API
- Suggested Books

Current Release

- Change Log
- Release Notes
- Version: 18.4

Last Modified: Mar 15, 2009

# Bayesian Networks

This page documents all the tools within the dlib library that relate to the construction and evaluation of Bayesian networks. If you want a quick introduction to the tools then you should consult the Bayesian Net example program.

The library also comes with a graphical application to assist in the creation of bayesian networks. This application is one of the example programs, so to use it you have to compile it yourself or download one of the binaries from the sourceforge download page.

Tools

- assignment
- bayesian_network_gibbs_sampler
- bayesian_network_join_tree
- bayes_node
- conditional_probability_table
- joint_probability_table

Node Utilities

- node_cpt_filled_out
- node_first_parent_assignment
- node_is_evidence
- node_next_parent_assignment
- node_num_values
- node_probability
- node_value
- set_node_as_evidence
- set_node_as_nonevidence
- set_node_num_values
- set_node_probability
- set_node_value

[top]

# assignment

This object models an assignment of random variables to particular values. It is used with the joint_probability_table and conditional_probability_table objects to represent assignments of various random variables to actual values.
`#include <dlib/bayes_utils.h>`
Detailed Documentation
C++ Example Programs: bayes_net_ex.cpp, bayes_net_gui_ex.cpp
[top]

# bayesian_network_gibbs_sampler

This object performs Markov Chain Monte Carlo sampling of a bayesian network using the Gibbs sampling technique.
`#include <dlib/bayes_utils.h>`
Detailed Documentation
C++ Example Programs: bayes_net_ex.cpp
[top]

# bayesian_network_join_tree

This object represents an implementation of the join tree algorithm (a.k.a. the junction tree algorithm) for inference in bayesian networks.
`#include <dlib/bayes_utils.h>`
Detailed Documentation
C++ Example Programs: bayes_net_ex.cpp, bayes_net_gui_ex.cpp, bayes_net_from_disk_ex.cpp
[top]

# bayes_node

This object represents a node in a bayesian network. It is intended to be used inside the directed_graph object to represent bayesian networks.
`#include <dlib/bayes_utils.h>`
Detailed Documentation
C++ Example Programs: bayes_net_ex.cpp, bayes_net_gui_ex.cpp
[top]

# conditional_probability_table

This object represents a conditional probability table.
`#include <dlib/bayes_utils.h>`
Detailed Documentation
[top]

# joint_probability_table

This object represents a joint probability table.
`#include <dlib/bayes_utils.h>`
Detailed Documentation
[top]

# node_cpt_filled_out

This is a function declared in the dlib::bayes_node_utils namespace. It is a convenience function that allows you to easily verify that a node in a bayesian network has its conditional_probability_table completely filled out.
`#include <dlib/bayes_utils.h>`
Detailed Documentation
C++ Example Programs: bayes_net_gui_ex.cpp
[top]

# node_first_parent_assignment

This is a function declared in the dlib::bayes_node_utils namespace. It is a convenience function that allows you to easily obtain an assignment that contains all the parents of a node in a bayesian network.
`#include <dlib/bayes_utils.h>`
Detailed Documentation
C++ Example Programs: bayes_net_gui_ex.cpp
[top]

# node_is_evidence

This is a function declared in the dlib::bayes_node_utils namespace. It is a convenience function that allows you to easily determine if a bayes_node is evidence when it is inside a directed_graph object.
`#include <dlib/bayes_utils.h>`
Detailed Documentation
[top]

# node_next_parent_assignment

This is a function declared in the dlib::bayes_node_utils namespace. It is a convenience function that allows you to easily loop through all the parent assignments of a node in a bayesian network.
`#include <dlib/bayes_utils.h>`
Detailed Documentation
C++ Example Programs: bayes_net_gui_ex.cpp
[top]

# node_num_values

This is a function declared in the dlib::bayes_node_utils namespace. It is a convenience function that allows you to easily obtain the number of values of a bayes_node when it is inside a directed_graph object.
`#include <dlib/bayes_utils.h>`
Detailed Documentation
[top]

# node_probability

This is a function declared in the dlib::bayes_node_utils namespace. It is a convenience function that allows you to easily obtain the probability of a bayes_node given its parents when it is inside a directed_graph object.
`#include <dlib/bayes_utils.h>`
Detailed Documentation
[top]

# node_value

This is a function declared in the dlib::bayes_node_utils namespace. It is a convenience function that allows you to easily obtain the value of a bayes_node when it is inside a directed_graph object.
`#include <dlib/bayes_utils.h>`
Detailed Documentation
[top]

# set_node_as_evidence

This is a function declared in the dlib::bayes_node_utils namespace. It is a convenience function that allows you to easily set the evidence flag of a bayes_node when it is inside a directed_graph object.
`#include <dlib/bayes_utils.h>`
Detailed Documentation
C++ Example Programs: bayes_net_ex.cpp
[top]

# set_node_as_nonevidence

This is a function declared in the dlib::bayes_node_utils namespace. It is a convenience function that allows you to easily remove the evidence flag of a bayes_node when it is inside a directed_graph object.
`#include <dlib/bayes_utils.h>`
Detailed Documentation
C++ Example Programs: bayes_net_ex.cpp
[top]

# set_node_num_values

This is a function declared in the dlib::bayes_node_utils namespace. It is a convenience function that allows you to easily set the number of values of a bayes_node when it is inside a directed_graph object.
`#include <dlib/bayes_utils.h>`
Detailed Documentation
C++ Example Programs: bayes_net_ex.cpp
[top]

# set_node_probability

This is a function declared in the dlib::bayes_node_utils namespace. It is a convenience function that allows you to easily set the probability of a bayes_node given its parents when it is inside a directed_graph object.
`#include <dlib/bayes_utils.h>`
Detailed Documentation
C++ Example Programs: bayes_net_ex.cpp
[top]

# set_node_value

This is a function declared in the dlib::bayes_node_utils namespace. It is a convenience function that allows you to easily modify the value of a bayes_node when it is inside a directed_graph object.
`#include <dlib/bayes_utils.h>`
Detailed Documentation
C++ Example Programs: bayes_net_ex.cpp