Probabilistic Relational Models

For now, pyAgrum only allows to explore Probabilistic Relational Models written with o3prm syntax (see O3PRM website).

class pyAgrum.PRMexplorer

PRMexplorer helps navigate through probabilistic relational models.

PRMexplorer() -> PRMexplorer

default constructor

property aggType

min/max/count/exists/forall/or/and/amplitude/median

classAggregates(class_name)
Parameters:

class_name (str) – a class name

Returns:

the list of aggregates in the class

Return type:

list

Raises:

pyAgrum.IndexError – If the class is not in the PRM

classAttributes(class_name)
Parameters:

class_name (str) – a class name

Returns:

the list of attributes

Return type:

list

Raises:

pyAgrum.IndexError – If the class is not in the PRM

classDag(class_name)
Parameters:

class_name (str) – a class name

Returns:

a description of the DAG

Return type:

tuple

Raises:

pyAgrum.IndexError – If the class is not in the PRM

classImplements(class_name)
Parameters:

class_name (str) – a class name

Returns:

the list of interfaces implemented by the class

Return type:

list

classParameters(class_name)
Parameters:

class_name (str) – a class name

Returns:

the list of parameters

Return type:

list

Raises:

pyAgrum.IndexError – If the class is not in the PRM

classReferences(class_name)
Parameters:

class_name (str) – a class name

Returns:

the list of references

Return type:

list

Raises:

pyAgrum.IndexError – If the class is not in the PRM

classSlotChains(class_name)
Parameters:

class_name (str) – a class name

Returns:

the list of class slot chains

Return type:

list

Raises:

pyAgrum.IndexError – if the class is not in the PRM

classes()
Returns:

the list of classes

Return type:

list

cpf(class_name, attribute)
Parameters:
  • class_name (str) – a class name

  • attribute (str) – an attribute

Returns:

the potential of the attribute

Return type:

pyAgrum.Potential

Raises:
  • pyAgrum.OperationNotAllowed – If the class element doesn’t have any pyAgrum.Potential (like a pyAgrum.PRMReferenceSlot).

  • pyAgrum.IndexError – If the class is not in the PRM

  • pyAgrum.IndexError – If the attribute in parameters does not exist

getDirectSubClass(class_name)
Parameters:

class_name (str) – a class name

Returns:

the list of direct subclasses

Return type:

list

Raises:

pyAgrum.IndexError – If the class is not in the PRM

getDirectSubInterfaces(interface_name)
Parameters:

interface_name (str) – an interface name

Returns:

the list of direct subinterfaces

Return type:

list

Raises:

pyAgrum.IndexError – If the interface is not in the PRM

getDirectSubTypes(type_name)
Parameters:

type_name (str) – a type name

Returns:

the list of direct subtypes

Return type:

list

Raises:

pyAgrum.IndexError – If the type is not in the PRM

getImplementations(interface_name)
Parameters:

interface_name (str) – an interface name

Returns:

the list of classes implementing the interface

Return type:

str

Raises:

pyAgrum.IndexError – If the interface is not in the PRM

getLabelMap(type_name)
Parameters:

type_name (str) – a type name

Returns:

a dict containing pairs of label and their values

Return type:

dict

Raises:

pyAgrum.IndexError – If the type is not in the PRM

getLabels(type_name)
Parameters:

type_name (str) – a type name

Returns:

the list of type labels

Return type:

list

Raises:

pyAgrum.IndexError – If the type is not in the PRM

getSuperClass(class_name)
Parameters:

class_name (str) – a class name

Returns:

the class extended by class_name

Return type:

str

Raises:

pyAgrum.IndexError – If the class is not in the PRM

getSuperInterface(interface_name)
Parameters:

interface_name (str) – an interface name

Returns:

the interace extended by interface_name

Return type:

str

Raises:

pyAgrum.IndexError – If the interface is not in the PRM

getSuperType(type_name)
Parameters:

type_name (str) – a type name

Returns:

the type extended by type_name

Return type:

str

Raises:

pyAgrum.IndexError – If the type is not in the PRM

getalltheSystems()
Returns:

the list of all the systems and their components

Return type:

list

interAttributes(interface_name, allAttributes=False)
Parameters:
  • interface_name (str) – an interface

  • allAttributes (bool) – True if supertypes of a custom type should be indicated

Returns:

the list of (<type>,<attribute_name>) for the given interface

Return type:

list

Raises:

pyAgrum.IndexError – If the type is not in the PRM

interReferences(interface_name)
Parameters:

interface_name (str) – an interface

Returns:

the list of (<reference_type>,<reference_name>,<True if the reference is an array>) for the given interface

Return type:

list

Raises:

pyAgrum.IndexError – If the type is not in the PRM

interfaces()
Returns:

the list of interfaces in the PRM

Return type:

list

isAttribute(class_name, att_name)
Parameters:
  • class_name (str) – a class name

  • att_name (str) – the name of the attribute to be tested

Returns:

True if att_name is an attribute of class_name

Return type:

bool

Raises:
  • pyAgrum.IndexError – If the class is not in the PRM

  • pyAgrum.IndexError – If att_name is not an element of class_name

isClass(name)
Parameters:

name (str) – an element name

Returns:

True if the parameter correspond to a class in the PRM

Return type:

bool

isInterface(name)
Parameters:

name (str) – an element name

Returns:

True if the parameter correspond to an interface in the PRM

Return type:

bool

isType(name)
Parameters:

name (str) – an element name

Returns:

True if the parameter correspond to a type in the PRM

Return type:

bool

load(*args)

Load a PRM into the explorer.

Parameters:
  • filename (str) – the name of the o3prm file

  • classpath (str) – the classpath of the PRM

Raises:

pyAgrum.FatalError – If file not found

Return type:

None

types()
Returns:

the list of the custom types in the PRM

Return type:

list