sequince.steps.mutation.eryn
============================

.. py:module:: sequince.steps.mutation.eryn


Attributes
----------

.. autoapisummary::

   sequince.steps.mutation.eryn.logger


Classes
-------

.. autoapisummary::

   sequince.steps.mutation.eryn.ErynMutation


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

.. py:data:: logger

.. py:class:: ErynMutation(log_prob_fn, *, n_steps = 1, move = None, run_kwargs = None, transform = None, transform_refit = 'always', store_chains = False, metrics = (), vectorize = True)

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


   Fixed-dimensional mutation step using Eryn.

   :param log_prob_fn: Function to compute the log-probability of a particle position, or a
                       `Target` instance.
   :type log_prob_fn: callable or Target
   :param n_steps: Number of mutation steps to perform. Default is 1.
   :type n_steps: int, optional
   :param move: Eryn move to use for the mutation. If not provided, a default
                `StretchMove` is used.
   :type move: Eryn move object, optional
   :param run_kwargs: Additional keyword arguments to pass to the Eryn sampler's `sample`
                      method. Default is None.
   :type run_kwargs: dict, optional
   :param transform: Transform to apply to the particles before mutation. Default is None.
   :type transform: ParticleTransform, optional
   :param transform_refit: Strategy for refitting the transform. Default is "always".
   :type transform_refit: TransformRefit, optional
   :param store_chains: Whether to store the full chain of mutated particles. Default is False.
   :type store_chains: bool, optional
   :param metrics: Metrics to compute during mutation. Default is an empty list.
   :type metrics: list of MutationMetric, optional
   :param vectorize: Whether to vectorize the log-probability evaluation. Default is True.
   :type vectorize: bool, optional


   .. 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.



