splisosm.logger
===============

.. py:module:: splisosm.logger

.. autoapi-nested-parse::

   Training logger utilities for GLM/GLMM optimization.



Classes
-------

.. autoapisummary::

   splisosm.logger.PatienceLogger


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

.. py:class:: PatienceLogger(batch_size, patience, min_delta = 1e-05, diagnose = False)

   Logger for tracking training patience and convergence.

   For training MultinomGLM and MultinomGLMM.

   :param batch_size: Number of samples in the batch.
   :param patience: Number of epochs to wait after the last significant improvement.
   :param min_delta: Minimum change in the loss to qualify as an improvement.
   :param diagnose: Whether to store parameter changes during training.


   .. py:method:: get_params_iter()

      Return stored parameters during training if diagnose is True.

      :returns: List of dictionaries containing loss and parameters for each sample,
                or None if diagnose is False.
      :rtype: list[dict] or None



   .. py:method:: log(loss, params)

      Log loss for a given epoch and update best parameters if improved.

      :param loss: Loss for the current epoch.
      :param params: Parameters for the current epoch.



   .. py:attribute:: batch_size


   .. py:attribute:: best_epoch


   .. py:attribute:: best_loss


   .. py:attribute:: best_params
      :value: None



   .. py:attribute:: convergence


   .. py:attribute:: diagnose
      :value: False



   .. py:attribute:: epoch
      :value: 0



   .. py:attribute:: epochs_without_improvement


   .. py:attribute:: min_delta
      :value: 1e-05



   .. py:attribute:: patience


