BayesNet.propertyWithDefault

BayesNet.propertyWithDefault(name, byDefault)

Returns the value associated to this property or the default value if there is no such property.

Properties are a way to keep some information (name,value) together with de model.

Parameters:
  • name (str) – the name of the property

  • byDefault (str) – the value by default if no property has been found.

Returns:

The value associated to this name or the value by default.

Return type:

str

Example

import pyagrum as gum

bn = gum.fastBN("A->B")
bn.setProperty("author", "me")
bn.propertyWithDefault("author", "unknown")
# 'me'
bn.propertyWithDefault("license", "unknown")
# 'unknown'

Class

BayesNet