probabilistic_model.interfaces.mlflow_integration
=================================================

.. py:module:: probabilistic_model.interfaces.mlflow_integration


Classes
-------

.. autoapisummary::

   probabilistic_model.interfaces.mlflow_integration.ProbabilisticModelWrapper


Functions
---------

.. autoapisummary::

   probabilistic_model.interfaces.mlflow_integration.infer_signature


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

.. py:class:: ProbabilisticModelWrapper(model: typing_extensions.Optional[probabilistic_model.probabilistic_model.ProbabilisticModel] = None)

   Bases: :py:obj:`mlflow.pyfunc.PythonModel`


   Wrapper for a probabilistic model to be used with MLflow.

   The wrapper requires the artifact "model_path" to contain a path to a file that can be parsed using
   the SubclassJSONSerializer.


   .. py:attribute:: model
      :type:  typing_extensions.Optional[probabilistic_model.probabilistic_model.ProbabilisticModel]
      :value: None



   .. py:method:: load_context(context)

      Loads artifacts from the specified :class:`~PythonModelContext` that can be used by
      :func:`~PythonModel.predict` when evaluating inputs. When loading an MLflow model with
      :func:`~load_model`, this method is called as soon as the :class:`~PythonModel` is
      constructed.

      The same :class:`~PythonModelContext` will also be available during calls to
      :func:`~PythonModel.predict`, but it may be more efficient to override this method
      and load artifacts from the context at model load time.

      Args:
          context: A :class:`~PythonModelContext` instance containing artifacts that the model
                   can use to perform inference.



   .. py:method:: predict(context, model_input)

      Evaluates a pyfunc-compatible input and produces a pyfunc-compatible output.
      For more information about the pyfunc input/output API, see the :ref:`pyfunc-inference-api`.

      Args:
          context: A :class:`~PythonModelContext` instance containing artifacts that the model
                   can use to perform inference.
          model_input: A pyfunc-compatible input for the model to evaluate.
          params: Additional parameters to pass to the model for inference.

      .. tip::
          Since MLflow 2.20.0, `context` parameter can be removed from `predict` function
          signature if it's not used. `def predict(self, model_input, params=None)` is valid.



.. py:function:: infer_signature(model: probabilistic_model.probabilistic_model.ProbabilisticModel) -> mlflow.models.signature.ModelSignature

   Infer the signature of a probabilistic model.
   :param model: The model to infer the signature from.
   :return: The inferred signature.


