leaspy.algo.fit.base ==================== .. py:module:: leaspy.algo.fit.base .. autoapi-nested-parse:: This module defines the `AbstractFitAlgo` class used for fitting algorithms. .. !! processed by numpydoc !! Classes ------- .. autoapisummary:: leaspy.algo.fit.base.FitAlgorithm Module Contents --------------- .. py:class:: FitAlgorithm(settings) Bases: :py:obj:`leaspy.algo.base.IterativeAlgorithm`\ [\ :py:obj:`leaspy.algo.base.ModelType`\ , :py:obj:`leaspy.algo.base.ReturnType`\ ] Abstract class containing common method for all `fit` algorithm classes. The algorithm is proven to converge if the sequence `burn_in_step` is positive, with an infinite sum :math:`\sum_k \epsilon_k = +\infty` and a finite sum of the squares :math:`\sum_k \epsilon_k^2 < \infty` (see following paper). `Construction of Bayesian Deformable Models via a Stochastic Approximation Algorithm: A Convergence Study `_ :Parameters: **settings** : :class:`~leaspy.algo.AlgorithmSettings` The specifications of the algorithm as a :class:`~leaspy.algo.AlgorithmSettings` instance. :Attributes: **algorithm_device** : :obj:`str` Valid :class:`torch.device` **current_iteration** : :obj:`int`, default 0 The number of the current iteration. The first iteration will be 1 and the last one `n_iter`. **sufficient_statistics** : :obj:`dict` [:obj:`str`, :class:`torch.Tensor`] or None Sufficient statistics of the previous step. It is None during all the burn-in phase. **output_manager** : :class:`~leaspy.io.logs.fit_output_manager.FitOutputManager` Optional output manager of the algorithm **Inherited attributes** From :class:`~leaspy.algo.AbstractAlgo` .. seealso:: :meth:`leaspy.api.Leaspy.fit` .. .. !! processed by numpydoc !! .. py:attribute:: family .. py:attribute:: logs .. py:attribute:: sufficient_statistics :type: Optional[leaspy.utils.typing.DictParamsTorch] :value: None .. py:method:: set_output_manager(output_settings) Set a :class:`~leaspy.algo.fit.FitOutputManager` object for the run of the algorithm. :Parameters: **output_settings** : :class:`~leaspy.algo.OutputsSettings` Contains the logs settings for the computation run (console print periodicity, plot periodicity ...) .. rubric:: Examples >>> from leaspy.algo import AlgorithmSettings, algorithm_factory, OutputsSettings >>> algo_settings = AlgorithmSettings("mcmc_saem") >>> my_algo = algorithm_factory(algo_settings) >>> settings = { 'path': 'brouillons', 'print_periodicity': 50, 'plot_periodicity': 100, 'save_periodicity': 50 } >>> my_algo.set_output_manager(OutputsSettings(settings)) .. !! processed by numpydoc !!