stormvogel.bird

Attributes

Classes

BirdState

Represent a bird state as a dynamic attribute container.

Functions

_valid_input(delta, init[, rewards, labels, ...])

Validate the input for the bird model builder.

build_bird(→ stormvogel.model.Model[ValueType])

Build a stormvogel model from user-supplied callbacks.

__getattr__(name)

Module Contents

class stormvogel.bird.BirdState(**kwargs)

Represent a bird state as a dynamic attribute container.

__repr__()
__hash__()
__eq__(other)
type stormvogel.bird.BirdAction = str
stormvogel.bird._valid_input[ValueType: stormvogel.model.Value](delta: Callable[[Any, BirdAction], Any] | Callable[[Any], Any], init: Any, rewards: Callable[[Any], dict[str, ValueType]] | None = None, labels: Callable[[Any], Sequence[str] | str | None] | None = None, available_actions: Callable[[Any], list[BirdAction]] | None = None, observations: Callable[[Any], int | list[tuple[ValueType, int]]] | None = None, rates: Callable[[Any], float] | None = None, valuations: Callable[[Any], dict[stormvogel.model.Variable, float | int | bool]] | None = None, observation_valuations: Callable[[int], dict[stormvogel.model.Variable, float | int | bool]] | None = None, modeltype: stormvogel.model.ModelType = stormvogel.model.ModelType.MDP)

Validate the input for the bird model builder.

Check that all user-supplied callbacks have the correct number of parameters and that required callbacks are provided for the chosen model type.

Parameters:
  • delta – Transition function. Takes (state, action) for models that support actions, or (state,) otherwise.

  • init – Initial state passed to the callbacks.

  • rewards – Optional callback mapping a state to a dict of reward model name to reward value.

  • labels – Optional callback mapping a state to a list of label strings, a single label string, or None.

  • available_actions – Optional callback returning the list of available action strings for a state. Required for MDP, POMDP, and MA model types.

  • observations – Optional callback returning an observation id or a distribution over observations for a state. Required for POMDP and HMM model types.

  • rates – Optional callback returning the exit rate for a state.

  • valuations – Optional callback returning a dict of variable name to value for a state.

  • observation_valuations – Optional callback returning a dict of variable name to value for a given observation id.

  • modeltype – The type of model to build.

Raises:

ValueError – If a required callback is missing or any callback has an incorrect number of parameters.

stormvogel.bird.build_bird()

Build a stormvogel model from user-supplied callbacks.

Explore the state space starting from init by repeatedly calling delta (and available_actions for action-based models) until no new states are discovered, analogous to a PRISM module.

Parameters:
  • delta – Transition function. For action-based models it takes (state, action) and returns a list of (probability, state) tuples (or a single successor, or None for a self-loop). For models without actions it takes (state,).

  • init – Initial state of the model.

  • rewards – Optional callback mapping a state to a dict of reward model name to reward value.

  • labels – Optional callback mapping a state to a list of label strings, a single label string, or None.

  • friendly_names – Optional callback returning a friendly name for a state.

  • available_actions – Optional callback returning the list of available action strings for a state. Required for MDP, POMDP, and MA model types.

  • observations – Optional callback returning an observation id or a distribution over observations for a state. Required for POMDP and HMM model types.

  • rates – Optional callback returning the exit rate for a state.

  • valuations – Optional callback returning a dict of variable name to value for a state.

  • observation_valuations – Optional callback returning a dict of variable name to value for a given observation id.

  • modeltype – The type of model to build.

  • max_size – Maximum number of states before aborting.

Returns:

The constructed stormvogel model.

Raises:
  • ValueError – If callbacks return invalid results during exploration.

  • RuntimeError – If the state space exceeds max_size.

stormvogel.bird.__getattr__(name: str)