clipppy.commands.command

Module Contents

class clipppy.commands.command.Command(**kwargs)

An abstract base class for commands.

Defines an interface that allows manipulating parameters of the command in three distinct ways. Firstly, the class object itself provides the defaults. Next, when an instance is created, the constructor takes arbitrary keyword arguments that will be set as instance attributes overriding the defaults. Finally, when a class instance is called, any possible parameters that are included in the :python:**kwargs parameter are extracted and set on the instance before execution of the forward method, which should be overridden to provide the actual command implementation.

Commands also support “binding” keyword parameters in much the same way as functools.partial, through the boundkwargs property. The provided keywords are then always included in the forward call, if the forward call has explicit parameters with the same names.

boundkwargs :dict

A dictionary of values to be forwarded to each call of forward, if there are exact name matches in its signature.

no_call

Special value to be used to indicate that instead of calling an object, it should be returned as is.

plate_stack :Union[Iterable[int], ContextManager]

A stack of plates or an iterable of ints.

Either one or multiple plates (as returned by pyro.plate or pyro.plate_stack) or an iterable of ints that will be converted to a stack of plates (named plate_0, etc. and aligned to rightmost_dim = -1) for batch mock generation.

__call__(self, *args, **kwargs)
__getattribute__(self, name)

Return getattr(self, name).

property attr_names(self) list[str]
abstract forward(self, *args, **kwargs)
property plate(self) pyro.plate
setattr(self, kwargs: dict[str, Any])
class clipppy.commands.command.SamplingCommand(**kwargs)

An abstract base class for commands.

Defines an interface that allows manipulating parameters of the command in three distinct ways. Firstly, the class object itself provides the defaults. Next, when an instance is created, the constructor takes arbitrary keyword arguments that will be set as instance attributes overriding the defaults. Finally, when a class instance is called, any possible parameters that are included in the :python:**kwargs parameter are extracted and set on the instance before execution of the forward method, which should be overridden to provide the actual command implementation.

Commands also support “binding” keyword parameters in much the same way as functools.partial, through the boundkwargs property. The provided keywords are then always included in the forward call, if the forward call has explicit parameters with the same names.

conditioning :bool = False

Whether to retain any conditioning already applied to the model. If a false value, pyro.poutine.handlers.uncondition will be applied to model before evaluating.

initting :bool = True

Whether to respect init values in config sites.

savename :str

Filename to save the sample to (or None to skip saving).

property init(self)
property uncondition(self)