sequince.steps.mutation.minipcn
===============================

.. py:module:: sequince.steps.mutation.minipcn


Attributes
----------

.. autoapisummary::

   sequince.steps.mutation.minipcn.logger


Classes
-------

.. autoapisummary::

   sequince.steps.mutation.minipcn.MiniPCNOutput
   sequince.steps.mutation.minipcn.MiniPCNMutation


Module Contents
---------------

.. py:data:: logger

.. py:class:: MiniPCNOutput

   Bases: :py:obj:`collections.abc.Mapping`\ [\ :py:obj:`str`\ , :py:obj:`Any`\ ]


   MiniPCN results with block acceptance in ``metrics.acceptance``.

   ``acceptance_by_step`` contains the backend's accepted fraction per step.


   .. py:attribute:: acceptance_by_step
      :type:  Any


   .. py:attribute:: step_fn
      :type:  str


   .. py:attribute:: steps
      :type:  int


   .. py:attribute:: chain
      :type:  Any


   .. py:attribute:: metrics
      :type:  Any
      :value: None



.. py:class:: MiniPCNMutation(log_prob_fn, *, n_steps = 1, step_fn = 'tpcn', verbose = False, transform = None, transform_refit = 'always', store_chains = False, metrics = (), **kwargs)

   Bases: :py:obj:`sequince.steps.mutation.base.MutationStep`


   Run MiniPCN MCMC moves to rejuvenate particles.

   By default uses the 'tpcn' step function and targets an acceptance rate of 0.234.
   Also sets 'verbose' to False by default.

   Wrap with ``AdaptiveMiniPCNMutation`` for tuning between fixed mutation
   blocks. The backend ``adaptive=True`` option instead tunes rho inside
   sampling and cannot be combined with that wrapper.


   .. py:method:: apply(state, context, rng)


   .. py:method:: apply_with_mutation_state(state, context, rng, *, n_steps, mutation_state = None)

      Run transitions within a block without finalizing metrics.

      Pass ``mutation_state=None`` to initialize a new block; otherwise pass
      the state returned by the preceding call. The state holds individual
      metric states and cumulative acceptance bookkeeping. It must belong
      to the same metric configuration and mutation coordinate space.

      Returns ``(state, context, output, mutation_state)``. The output's
      metrics remain unset, including on the first and zero-step calls.
      Concrete mutations prepare existing metrics on entry, update state for each
      transition, and return it explicitly without calling metric.result().
      Runtime state must never be stored on the mutation object.

      Use ``apply`` or ``apply_with_n_steps`` for a complete standalone block.
      RepeatedMutationStep uses this method to continue across rounds and
      finalizes metrics once after the complete block.



   .. py:method:: apply_functional(state, context, random_state)

      Run MiniPCN while explicitly threading backend random state.



