nessai.flowmodel.importance
===========================

.. py:module:: nessai.flowmodel.importance

.. autoapi-nested-parse::

   FlowModel for use in importance nested sampling.

   ..
       !! processed by numpydoc !!


Classes
-------

.. autoapisummary::

   nessai.flowmodel.importance.ImportanceFlowModel


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

.. py:class:: ImportanceFlowModel(flow_config: dict = None, training_config: dict = None, output: str = None, rng: Optional[numpy.random.Generator] = None)

   Bases: :py:obj:`nessai.flowmodel.base.FlowModel`


   
   Flow Model that contains multiple flows for importance sampler.
















   ..
       !! processed by numpydoc !!

   .. py:property:: model

      
      The current flow (model).

      Returns None if the no models have been added.















      ..
          !! processed by numpydoc !!


   .. py:property:: n_models
      :type: int


      
      Number of models (flows)
















      ..
          !! processed by numpydoc !!


   .. py:method:: initialise() -> None

      
      Initialise things
















      ..
          !! processed by numpydoc !!


   .. py:method:: reset_optimiser() -> None

      
      Reset the optimiser to point at current model.

      Uses the original optimiser and kwargs.















      ..
          !! processed by numpydoc !!


   .. py:method:: add_new_flow(reset=False)

      
      Add a new flow
















      ..
          !! processed by numpydoc !!


   .. py:method:: log_prob_ith(x, i)

      
      Compute the log-prob for the ith flow
















      ..
          !! processed by numpydoc !!


   .. py:method:: log_prob_all(x)

      
      Compute the log probability using all of the stored models.
















      ..
          !! processed by numpydoc !!


   .. py:method:: sample_ith(i, N=1)

      
      Draw samples from the ith flow
















      ..
          !! processed by numpydoc !!


   .. py:method:: save_weights(weights_file) -> None

      
      Save the weights file.
















      ..
          !! processed by numpydoc !!


   .. py:method:: load_all_weights() -> None

      
      Load all of the weights files for each flow.

      Resets any existing models.















      ..
          !! processed by numpydoc !!


   .. py:method:: update_weights_path(weights_path: str, n: Optional[int] = None) -> None

      
      Update the weights path.

      Searches in the specified directory for weights files.

      :Parameters:

          **weights_path** : str
              Path to the directory that contains the weights files.

          **n** : Optional[int]
              The number of files to load. If not specified, :code:`n_models` is
              used instead. Must be specified when resuming since the models list
              is not saved.














      ..
          !! processed by numpydoc !!


   .. py:method:: resume(flow_config: dict, weights_path: Optional[str] = None) -> None

      
      Resume the model
















      ..
          !! processed by numpydoc !!


