code: def log_model(
      sktime_model,
      artifact_path,
      conda_env=None,
      code_paths=None,
      registered_model_name=None,
      signature=None,
      input_example=None,
      await_registration_for=None,
      pip_requirements=None,
      extra_pip_requirements=None,
      serialization_format=SERIALIZATION_FORMAT_PICKLE,
      **kwargs,
  ):  # TODO: can we specify a type for fitted instance of sktime model below?
      """Log a sktime model as an MLflow artifact for the current run.
  
      Parameters
      ----------
      sktime_model : fitted sktime model
          Fitted sktime model object.
      artifact_path : str
          Run-relative artifact path to save the model to.
      conda_env : Union[dict, str], optional (default=None)
          Either a dictionary representation of a Conda environment or the path to a
          conda environment yaml file.
      code_paths : array-like, optional (default=None)
          A list of local filesystem paths to Python file dependencies (or directories
          containing file dependencies). These files are *prepended* to the system path
          when the model is loaded.
      registered_model_name : str, optional (default=None)
          If given, create a model version under ``registered_model_name``, also creating
          a registered model if one with the given name does not exist.
      signature : mlflow.models.signature.ModelSignature, optional (default=None)
          Model Signature mlflow.models.ModelSignature describes
          model input and output :py:class:`Schema <mlflow.types.Schema>`. The model
          signature can be :py:func:`inferred <mlflow.models.infer_signature>` from
          datasets with valid model input (e.g. the training dataset with target column
          omitted) and valid model output (e.g. model predictions generated on the
          training dataset), for example:
  
          .. code-block:: py
  
            from mlflow.models.signature import infer_signature
            train = df.drop_column("target_label")
            predictions = ... # compute model predictions
            signature = infer_signature(train, predictions)
  
          .. Warning:: if performing probabilistic forecasts (``predict_interval``,
            ``predict_quantiles``) with a sktime model, the signature
            on the returned prediction object will not be correctly inferred due
            to the Pandas MultiIndex column type when using the these methods.
            ``infer_schema`` will function correctly if using the ``pyfunc`` flavor
            of the model, though. The ``pyfunc`` flavor of the model supports sktime
            predict methods ``predict``, ``predict_interval``, ``predict_quantiles``
            and ``predict_var`` while ``predict_proba`` and ``predict_residuals`` are
            currently not supported.
      input_example : Union[pandas.core.frame.DataFrame, numpy.ndarray, dict, list, csr_matrix, csc_matrix], optional (default=None)
          Input example provides one or several instances of valid model input.
          The example can be used as a hint of what data to feed the model. The given
          example will be converted to a ``Pandas DataFrame`` and then serialized to json
          using the ``Pandas`` split-oriented format. Bytes are base64-encoded.
      await_registration_for : int, optional (default=None)
          Number of seconds to wait for the model version to finish being created and is
          in ``READY`` status. By default, the function waits for five minutes. Specify 0
          or None to skip waiting.
      pip_requirements : Union[Iterable, str], optional (default=None)
          Either an iterable of pip requirement strings
          (e.g. ["sktime", "-r requirements.txt", "-c constraints.txt"]) or the string
          path to a pip requirements file on the local filesystem
          (e.g. "requirements.txt")
      extra_pip_requirements : Union[Iterable, str], optional (default=None)
          Either an iterable of pip requirement strings
          (e.g. ["pandas", "-r requirements.txt", "-c constraints.txt"]) or the string
          path to a pip requirements file on the local filesystem
          (e.g. "requirements.txt")
      serialization_format : str, optional (default="pickle")
          The format in which to serialize the model. This should be one of the formats
          "pickle" or "cloudpickle"
      kwargs:
          Additional arguments for :py:class:`mlflow.models.model.Model`
  
      Returns
      -------
      A :py:class:`ModelInfo <mlflow.models.model.ModelInfo>` instance that contains the
      metadata of the logged model.
  
      See Also
      --------
      MLflow
  
      References
      ----------
      .. [1] https://www.mlflow.org/docs/latest/python_api/mlflow.models.html#mlflow.models.Model.log
  
      >>> import mlflow  # doctest: +SKIP
      >>> from mlflow.utils.environment import _mlflow_conda_env  # doctest: +SKIP
      >>> from sktime.datasets import load_airline  # doctest: +SKIP
      >>> from sktime.forecasting.arima import ARIMA  # doctest: +SKIP
      >>> from sktime.utils import mlflow_sktime  # doctest: +SKIP
      >>> y = load_airline()  # doctest: +SKIP
      >>> forecaster = ARIMA(  # doctest: +SKIP
      ...     order=(1, 1, 0),
      ...     seasonal_order=(0, 1, 0, 12),
      ...     suppress_warnings=True)
      >>> forecaster.fit(y)  # doctest: +SKIP
      ARIMA(...)
      >>> mlflow.start_run()  # doctest: +SKIP
      >>> artifact_path = "model"  # doctest: +SKIP
      >>> model_info = mlflow_sktime.log_model(
      ...     sktime_model=forecaster,
      ...     artifact_path=artifact_path)  # doctest: +SKIP
      """  # noqa: E501
      _check_mlflow_dependencies(severity="error")
      from mlflow.models import Model
  
      if await_registration_for is None:
          from mlflow.tracking._model_registry import (
              DEFAULT_AWAIT_MAX_SLEEP_SECONDS,
          )
  
          await_registration_for = DEFAULT_AWAIT_MAX_SLEEP_SECONDS
  
      return Model.log(
          artifact_path=artifact_path,
          flavor=utils.mlflow_sktime,
          registered_model_name=registered_model_name,
          sktime_model=sktime_model,
          conda_env=conda_env,
          code_paths=code_paths,
          signature=signature,
          input_example=input_example,
          await_registration_for=await_registration_for,
          pip_requirements=pip_requirements,
          extra_pip_requirements=extra_pip_requirements,
          serialization_format=serialization_format,
          **kwargs,
      )
  
file_path: sktime/sktime/utils/mlflow_sktime.py
imports: import logging
  import os
  import pandas
  import yaml
  import sktime
  from sktime import utils
  from sktime.base._serialize import load
  from sktime.utils.multiindex import flatten_multiindex
  from sktime.utils.validation._dependencies import _check_mlflow_dependencies
label_desc: Use image node_id 4 for calling a global function with example usage: log_model(sktime_model, artifact_path, conda_env, code_paths, registered_model_name, signature, input_example, await_registration_for, pip_requirements, extra_pip_requirements, serialization_format) and returns: Model