torchtree.inference.mcmc.operator#

Classes#

MCMCOperator

Abstract class making an object identifiable.

ScalerOperator

Abstract class making an object identifiable.

SlidingWindowOperator

Abstract class making an object identifiable.

DirichletOperator

Abstract class making an object identifiable.

Module Contents#

class torchtree.inference.mcmc.operator.MCMCOperator(id_: torchtree.typing.ID, parameters: list[torchtree.typing.Parameter], weight: float, target_acceptance_probability: float, **kwargs)[source]#

Bases: torchtree.core.identifiable.Identifiable, abc.ABC

Abstract class making an object identifiable.

Parameters:

id (str or None) – identifier of object

parameters#
weight#
target_acceptance_probability#
property tuning_parameter: float#
Abstractmethod:

property adaptable_parameter: float#
Abstractmethod:

abstract set_adaptable_parameter(value: float) None[source]#
step() torch.Tensor[source]#
accept() None[source]#
reject() None[source]#
smoothed_acceptance_rate() float[source]#
tune(acceptance_prob: torch.Tensor, sample: int, accepted: bool) None[source]#
state_dict() dict[str, Any][source]#
load_state_dict(state_dict: dict[str, Any]) None[source]#
class torchtree.inference.mcmc.operator.ScalerOperator(id_: torchtree.typing.ID, parameters: list[torchtree.typing.Parameter], weight: float, target_acceptance_probability: float, scaler: float, **kwargs)[source]#

Bases: MCMCOperator

Abstract class making an object identifiable.

Parameters:

id (str or None) – identifier of object

property tuning_parameter: float#
adaptable_parameter() float#
set_adaptable_parameter(value: float) None[source]#
classmethod from_json(data, dic)[source]#

Abstract method to create object from a dictionary.

Parameters:
  • data (dict[str, Any]) – dictionary representation of a torchtree object.

  • dic (dict[str, Any]) – dictionary containing other torchtree objects keyed by their ID.

Returns:

torchtree object.

Return type:

Any

class torchtree.inference.mcmc.operator.SlidingWindowOperator(id_: torchtree.typing.ID, parameters: list[torchtree.typing.Parameter], weight: float, target_acceptance_probability: float, width: float, **kwargs)[source]#

Bases: MCMCOperator

Abstract class making an object identifiable.

Parameters:

id (str or None) – identifier of object

property tuning_parameter: float#
adaptable_parameter() float#
set_adaptable_parameter(value: float) None[source]#
classmethod from_json(data, dic)[source]#

Abstract method to create object from a dictionary.

Parameters:
  • data (dict[str, Any]) – dictionary representation of a torchtree object.

  • dic (dict[str, Any]) – dictionary containing other torchtree objects keyed by their ID.

Returns:

torchtree object.

Return type:

Any

class torchtree.inference.mcmc.operator.DirichletOperator(id_: torchtree.typing.ID, parameters: torchtree.typing.Parameter, weight: float, target_acceptance_probability: float, scaler: float, **kwargs)[source]#

Bases: MCMCOperator

Abstract class making an object identifiable.

Parameters:

id (str or None) – identifier of object

property tuning_parameter: float#
adaptable_parameter() float#
set_adaptable_parameter(value: float) None[source]#
classmethod from_json(data, dic)[source]#

Abstract method to create object from a dictionary.

Parameters:
  • data (dict[str, Any]) – dictionary representation of a torchtree object.

  • dic (dict[str, Any]) – dictionary containing other torchtree objects keyed by their ID.

Returns:

torchtree object.

Return type:

Any