checkFastSyntax
- pyagrum.checkFastSyntax(*args)
Check a fast description for every fast syntax.
A description may be valid for several syntaxes:
'A->B'is a directed graph, a mixed graph, a marked graph, a Bayesian network and an influence diagram. It is valid for a syntax if the corresponding fast function accepts it, apart from the constraints checked when the object is built (acyclicity, children of a utility node…).- Parameters:
description (
str) – the fast descriptiondefaultDomain (
str) – the domain of the variables without one, for the graphical models ('[2]'by default)
- Returns:
the verdict for every syntax
- Return type:
- Raises:
pyagrum.InvalidArgument – If defaultDomain does not begin with
'['or'{'.
Example
import pyagrum as gum
check = gum.checkFastSyntax("A->B->C")
[syntax.name for syntax in check.validSyntaxes()]
# ['DiGraph', 'MixedGraph', 'MarkedGraph', 'BayesNet', 'InfluenceDiagram']
[syntax.name for syntax in gum.checkFastSyntax("A--B--C").validSyntaxes()]
# ['MarkovRandomField']
[syntax.name for syntax in gum.checkFastSyntax("A{yes|no}->Visit Asia").validSyntaxes()]
# ['BayesNet', 'InfluenceDiagram']
bool(gum.checkFastSyntax("A->"))
# False