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

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

.. autoapi-nested-parse::

   Fit MiniPCN geometry per block and adapt rho between SMC iterations.



Classes
-------

.. autoapisummary::

   sequince.steps.mutation.adaptive.minipcn.AdaptiveMiniPCNMutation


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

.. py:class:: AdaptiveMiniPCNMutation(mutation, policy = None, *, initial_rho = 0.5)

   Bases: :py:obj:`sequince.steps.mutation.adaptive.base.AdaptiveMutationStep`


   Adapt MiniPCN proposals between complete blocks (eager execution only).

   :param mutation: A non-adaptive MiniPCN mutation, optionally inside repeated blocks.
                    Wrap the entire repeated block to freeze geometry and rho across all
                    rounds. Place conditional execution outside this wrapper.
   :type mutation: MiniPCNMutation or RepeatedMutationStep
   :param policy: Selects rho from completed block metrics. Defaults to
                  AcceptanceRateRhoPolicy. Stateful policies are checkpointed.
   :type policy: MiniPCNRhoPolicy or None, optional
   :param initial_rho: Initial proposal step size supplied to the policy, overriding the
                       child's rho. Default 0.5.
   :type initial_rho: float, optional

   .. rubric:: Notes

   Requires equal, finite particle weights: place after resampling. Before
   the first nonempty round, fit mu, covariance and (for tPCN) nu using
   MiniPCN's unweighted fitter in latent coordinates. The fitted transform
   and proposal are frozen for the entire block. Transform refit policies
   are consulted once per nonempty block, not once per round.

   Completed acceptance selects rho for the next context iteration. Further
   calls at the same iteration reuse rho and do not update it again; each
   call still fits geometry from its starting population. Empty blocks do
   not consume an adaptation update. Metrics include ``minipcn_adaptation``
   with ``rho`` and ``next_rho``.

   Checkpoints retain rho decisions and the child's transform state. Geometry
   is temporary block state and is fitted again at the next call. Reconstruct
   the same configuration before restoring a checkpoint. No adaptive pilot
   transitions are performed. As with other population-adaptive SMC methods,
   freezing each block is not a claim of exact finite-population invariance.


   .. py:attribute:: initial_rho


   .. py:attribute:: policy


   .. py:property:: current_rho
      :type: float


      Step size used for the current or most recent outer iteration.


   .. py:property:: next_rho
      :type: float


      Step size proposed for the next outer iteration.


   .. py:method:: apply_with_n_steps(state, context, rng, *, n_steps)

      Run a complete block with an externally selected fixed budget.



   .. py:method:: state_dict()

      Save completed-block tuning decisions and nested mutation state.



   .. py:method:: load_state_dict(state)

      Restore tuning without rerunning an adaptation update.



