sequince.steps.mutation.adaptive.policies.rho
=============================================

.. py:module:: sequince.steps.mutation.adaptive.policies.rho

.. autoapi-nested-parse::

   Policies selecting MiniPCN step sizes from completed mutation blocks.



Classes
-------

.. autoapisummary::

   sequince.steps.mutation.adaptive.policies.rho.MiniPCNRhoPolicy
   sequince.steps.mutation.adaptive.policies.rho.AcceptanceRateRhoPolicy


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

.. py:class:: MiniPCNRhoPolicy

   Bases: :py:obj:`Protocol`


   Choose rho before a block and from its completed metrics.

   Decisions must be scalar, finite and strictly between zero and one.
   Stateful policies may supply ``state_dict`` and ``load_state_dict``;
   the wrapper forwards these when checkpointing. Policies never see
   intermediate rounds or mutate the sampler.


   .. py:method:: initialise(*, initial_rho, context)

      Choose the first iteration's step size.



   .. py:method:: update(*, current_rho, metrics, context)

      Choose the next iteration's step size from one complete block.



.. py:class:: AcceptanceRateRhoPolicy

   Tune rho toward a target acceptance using a bounded multiplicative update.

   :param target_acceptance: Desired acceptance fraction. Default 0.234.
   :type target_acceptance: float, optional
   :param adaptation_rate: Rate in ``rho * exp(rate * (acceptance - target))``. Default 0.1.
                           Zero retains rho exactly after initial clipping.
   :type adaptation_rate: float, optional
   :param min_rho: Bounds strictly between zero and one. Defaults 0.001 and 0.99.
                   Initial rho is clipped to these bounds.
   :type min_rho: float, optional
   :param max_rho: Bounds strictly between zero and one. Defaults 0.001 and 0.99.
                   Initial rho is clipped to these bounds.
   :type max_rho: float, optional

   .. rubric:: Notes

   Higher acceptance increases the next block's proposal step size. Updates
   use finalized accepted and attempted counts; fractional counts are valid.
   Empty blocks retain rho. This policy has no evolving state; checkpoint
   configuration is validated when restoring into a reconstructed policy.


   .. py:attribute:: target_acceptance
      :type:  float
      :value: 0.234



   .. py:attribute:: adaptation_rate
      :type:  float
      :value: 0.1



   .. py:attribute:: min_rho
      :type:  float
      :value: 0.001



   .. py:attribute:: max_rho
      :type:  float
      :value: 0.99



   .. py:method:: initialise(*, initial_rho, context)


   .. py:method:: update(*, current_rho, metrics, context)


   .. py:method:: state_dict()


   .. py:method:: load_state_dict(state)


