neural_lam.models.step_predictors.persistence
=============================================

.. py:module:: neural_lam.models.step_predictors.persistence

.. autoapi-nested-parse::

   Persistence baseline step predictor.



Classes
-------

.. autoapisummary::

   neural_lam.models.step_predictors.persistence.PersistencePredictor


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

.. py:class:: PersistencePredictor(datastore: neural_lam.datastore.BaseDatastore, output_std: bool = False, output_clamping_lower: dict[str, float] | None = None, output_clamping_upper: dict[str, float] | None = None, **_kwargs: object)

   Bases: :py:obj:`neural_lam.models.step_predictors.base.StepPredictor`


   Trivial baseline predictor that returns the previous state unchanged.

   At each AR step the predicted next state is simply the current state,
   i.e. ``X_{t+1} = X_t``.  This provides a persistence (no-change)
   baseline that can be evaluated through the standard
   ``ForecasterModule`` / ``ARForecaster`` pipeline.

   Initialize the PersistencePredictor.

   :param datastore: The datastore providing grid metadata and data access.
   :type datastore: BaseDatastore
   :param output_std: Ignored, a warning is logged if True. Persistence never predicts
                      uncertainty.
   :type output_std: bool, default False
   :param output_clamping_lower: Ignored, persistence returns the raw previous state.
   :type output_clamping_lower: dict, optional
   :param output_clamping_upper: Ignored, persistence returns the raw previous state.
   :type output_clamping_upper: dict, optional
   :param \*\*_kwargs: Absorbed so that the standard CLI kwargs (``graph_name``,
                       ``hidden_dim``, etc.) do not cause errors.


   .. py:method:: forward(prev_state: torch.Tensor, prev_prev_state: torch.Tensor, forcing: torch.Tensor) -> tuple[torch.Tensor, None]

      Return the previous state as the prediction.

      :param prev_state: Shape ``(B, num_grid_nodes, num_state_vars)``.
                         The current state ``X_t``.
      :type prev_state: torch.Tensor
      :param prev_prev_state: Shape ``(B, num_grid_nodes, num_state_vars)``.
                              The previous state ``X_{t-1}`` (unused).
      :type prev_prev_state: torch.Tensor
      :param forcing: Shape ``(B, num_grid_nodes, num_forcing_vars)``.
                      External forcings (unused).
      :type forcing: torch.Tensor

      :returns: * **pred_state** (*torch.Tensor*) -- Shape ``(B, num_grid_nodes, num_state_vars)``.
                  Equal to ``prev_state``.
                * **pred_std** (*None*) -- Always ``None``, persistence does not predict uncertainty.



