ContinuousPC¶
- class otagrum.ContinuousPC(*args)¶
ContinuousPC learner.
- Parameters:
- data2-d sequence of float
The data
- maxConditioningSetSizeint, optional
The maximum conditioning set for independecy test
- alphafloat
Hypothesis test threshold
Methods
PDAGtoDot
(pdag)Displays the PDAG in DOT format.
getPValue
(*args)P-value accessor.
getSepset
(x, y)Separator set indices accessor.
getSepsetNames
(x, y)Separator set names accessor.
getTTest
(*args)T-Test statistics accessor.
getTrace
()Returns a summary of the learning algorithm containing which conditional indepences have been found and the associated T-test and p-values.
Returns the verbosity flag value.
idFromName
(n)Id accessor.
isRemoved
(*args)Test if an arc is removed.
learnDAG
()Learn the DAG.
Learn the junction tree.
Learn the PDAG.
Learn the skeleton.
setVerbosity
(verbose)Change the value of verbosity flag.
skeletonToDot
(skeleton)Displays the skeleton graph to dot
Notes
PC algorithm is a constrained method allowing to learn the structure of a bayesian network. It consists in three steps : skeleton learning, V-structure searching and constraint propagation.
- __init__(*args)¶
- PDAGtoDot(pdag)¶
Displays the PDAG in DOT format.
- Parameters:
- pdag
pyAgrum.MixedGraph
dag
- pdag
- Returns:
- dotstr
Dot format representation
- getPValue(*args)¶
P-value accessor.
- Parameters:
- xstr
A variable’s name
- ystr
A variable’s name
- xint
A variable’s id
- yint
A variable’s id
- Returns:
- p_valuefloat
P-value of edge x - y
- getSepset(x, y)¶
Separator set indices accessor.
- Parameters:
- xint
Node id
- yint
Node id
- Returns:
- sep_set
openturns.Indices
Indices of variables in the separator set of variables x and y
- sep_set
- getSepsetNames(x, y)¶
Separator set names accessor.
- Parameters:
- xstr
A variable’s name
- ystr
A variables’s name
- Returns:
- sepset_names
openturns.Description
The names of variables in the separator set of variables x and y
- sepset_names
- getTTest(*args)¶
T-Test statistics accessor.
- Parameters:
- xstr
A variable’s name
- ystr
A variable’s name
- xint
A variable’s id
- yint
A variable’s id
- Returns:
- ttestfloat
T-Test statistics value of edge x - y
- getTrace()¶
Returns a summary of the learning algorithm containing which conditional indepences have been found and the associated T-test and p-values.
- Returns:
- trace
openturns.Description
Trace of the learning algorithm
- trace
- getVerbosity()¶
Returns the verbosity flag value.
- Returns:
- verbosebool
Verbosity flag value
- idFromName(n)¶
Id accessor.
- Parameters:
- nstr
Node name
- Returns:
- idint
Id of the node
- isRemoved(*args)¶
Test if an arc is removed.
- Parameters:
- xstr
A variable’s name
- ystr
A variable’s name
- xint
A variable’s id
- yint
A variable’s id
- Returns:
- removedbool
Whether the arc x-y has been removed, this is equivalent to x and y being independent
- learnDAG()¶
Learn the DAG.
- Returns:
- dag
NamedDAG
the learned DAG
- dag
Notes
This step starts with the learned PDAG and orient the remaining undirected edges by avoiding to add new V-structures unless it implies to create an oriented circle.
- learnJunctionTree()¶
Learn the junction tree.
- Returns:
- njt
NamedJunctionTree
the learned junction tree
- njt
Notes
In order to learn the junction tree, the PDAG is moralized and then triangulated giving an undirected graph. Each clique in this graph is then associated to a node in the junction tree and there is an edge between nodes sharing common variables. Finally to each edge is associated a separator containing the intersection of variables in the two linked nodes.
- learnPDAG()¶
Learn the PDAG.
- Returns:
- gum::MixedGraph
pyAgrum.MixedGraph
the learned PDAG
- gum::MixedGraph
Notes
This step starts with the learned skeleton and looks at each triplet of variables X, Y, Z such that X-Z-Y and there is no edge between X and Y. If Z is in the sepset of X and Y, that is if it was in the conditional set that allowed to remove the edge between X and Y then we orient the triplet as X->Z<-Y.
- learnSkeleton()¶
Learn the skeleton.
- Returns:
- gum::UndiGraph
pyAgrum.UndiGraph
The learned skeleton
- gum::UndiGraph
Notes
This step consists in taking the complete undirected graph on the set of variables and to remove an edge if the linked variables are independent conditionally to a subset of their neighbors.
- setVerbosity(verbose)¶
Change the value of verbosity flag.
- Parameters:
- verbosebool
New verbosity flag value. If True, a lot of details about the learning procedure are printed.
- skeletonToDot(skeleton)¶
Displays the skeleton graph to dot
- Parameters:
- pdag
pyAgrum.UndiGraph
dag
- pdag
- Returns:
- dotstr
Dot format representation