rbnet.base.RBN

class rbnet.base.RBN(*args, **kwargs)[source]

Bases: ABC

Base class for RBNs.

Public Data Attributes:

root_location

Return the location of the root variables.

inside_chart

Return the chart with inside probabilities for all variables.

terminal_chart

Return the chart with terminal variables.

prior

Return the prior transition (typically an instance of Prior), which has to implement Prior.marginal_likelihood().

Public Methods:

__init__(*args, **kwargs)

inside_schedule(*args, **kwargs)

Iterate through (batches of) non-terminal locations for computing inside probabilities.

cells()

Return iterable over cells (corresponding to the non-terminal variables).

init_inside(*args, **kwargs)

Initialise for parsing a new input.

update_inside_chart(var_idx, locations, values)

For the specified variable, update the chart for inside probabilities with given values at given locations.

inside(*args, **kwargs)

Compute the inside probabilities and return the marginal data likelihood.

Private Data Attributes:

_abc_impl

Inherited from ABC

_abc_impl


abstract cells()[source]

Return iterable over cells (corresponding to the non-terminal variables).

init_inside(*args, **kwargs)[source]

Initialise for parsing a new input. This function is called by inside() with all provided parameters. Derived classes may override it to implement tasks such as initialising charts for the non-terminal variables.

inside(*args, **kwargs)[source]

Compute the inside probabilities and return the marginal data likelihood.

Returns:

marginal likelihood

abstract property inside_chart

Return the chart with inside probabilities for all variables.

Returns:

inside chart

abstract inside_schedule(*args, **kwargs)[source]

Iterate through (batches of) non-terminal locations for computing inside probabilities. The iteration order has to respect dependencies, i.e., non-terminals

that depend on another non-terminal (in the generative direction, i.e. generates : ) have to be iterated BEFORE the non-terminals they depend on ( has to be visited before ).

Returns:

location or batch of locations

abstract property prior

Return the prior transition (typically an instance of Prior), which has to implement Prior.marginal_likelihood().

Returns:

prior

abstract property root_location

Return the location of the root variables. This is typically the value returned in the last iteration of inside_schedule()

Returns:

location of the root variables

abstract property terminal_chart

Return the chart with terminal variables.

Returns:

terminal chart

abstract update_inside_chart(var_idx, locations, values)[source]

For the specified variable, update the chart for inside probabilities with given values at given locations.

Parameters:
  • var_idx – specifies the variable

  • locations – locations to update

  • values – values to store in chart