gtsam  4.0.0
gtsam
gtsam::Signature Class Reference

Detailed Description

Signature for a discrete conditional density, used to construct conditionals.

The format is (Key % string) for nodes with no parents, and (Key | Key, Key = string) for nodes with parents.

The string specifies a conditional probability spec in the 00 01 10 11 order. For three-valued, it would be 00 01 02 10 11 12 20 21 22, etc...

For example, given the following keys

Key A("Asia"), S("Smoking"), T("Tuberculosis"), L("LungCancer"), B("Bronchitis"), E("Either"), X("XRay"), D("Dyspnoea");

These are all valid signatures (Asia network example):

A % "99/1" S % "50/50" T|A = "99/1 95/5" L|S = "99/1 90/10" B|S = "70/30 40/60" E|T,L = "F F F 1" X|E = "95/5 2/98" D|E,B = "9/1 2/8 3/7 1/9"

Public Member Functions

 Signature (const DiscreteKey &key)
 Constructor from DiscreteKey.
 
const DiscreteKeykey () const
 the variable key
 
const DiscreteKeysparents () const
 the parent keys
 
DiscreteKeys discreteKeysParentsFirst () const
 All keys, with variable key last.
 
KeyVector indices () const
 All key indices, with variable key first.
 
const boost::optional< Table > & table () const
 
std::vector< double > cpt () const
 
Signatureoperator, (const DiscreteKey &parent)
 Add a parent.
 
Signatureoperator= (const std::string &spec)
 Add the CPT spec - Fails in boost 1.40.
 
Signatureoperator= (const Table &table)
 Add the CPT spec directly as a table.
 

Public Types

typedef std::vector< double > Row
 Data type for the CPT.
 
typedef std::vector< RowTable
 

Friends

GTSAM_EXPORT friend std::ostream & operator<< (std::ostream &os, const Signature &s)
 provide streaming
 

The documentation for this class was generated from the following files: