code: def predict(self, X):
      from mlflow.exceptions import MlflowException
      from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE
  
      X = None if X.empty else X
      raw_predictions = {}
  
      if not hasattr(self.sktime_model, "pyfunc_predict_conf"):
          raw_predictions[SKTIME_PREDICT] = self.sktime_model.predict(
              X=X
          )
  
      else:
          if not isinstance(
              self.sktime_model.pyfunc_predict_conf, dict
          ):
              raise MlflowException(
                  f"Attribute {PYFUNC_PREDICT_CONF} must be of type dict.",
                  error_code=INVALID_PARAMETER_VALUE,
              )
  
          if (
              PYFUNC_PREDICT_CONF_KEY
              not in self.sktime_model.pyfunc_predict_conf
          ):
              raise MlflowException(
                  f"Attribute {PYFUNC_PREDICT_CONF} must contain "
                  f"a dictionary key {PYFUNC_PREDICT_CONF_KEY}.",
                  error_code=INVALID_PARAMETER_VALUE,
              )
  
          if isinstance(
              self.sktime_model.pyfunc_predict_conf[
                  PYFUNC_PREDICT_CONF_KEY
              ],
              list,
          ):
              predict_methods = self.sktime_model.pyfunc_predict_conf[
                  PYFUNC_PREDICT_CONF_KEY
              ]
              predict_params = False
          elif isinstance(
              self.sktime_model.pyfunc_predict_conf[
                  PYFUNC_PREDICT_CONF_KEY
              ],
              dict,
          ):
              predict_methods = list(
                  self.sktime_model.pyfunc_predict_conf[
                      PYFUNC_PREDICT_CONF_KEY
                  ].keys()
              )
              predict_params = True
          else:
              raise MlflowException(
                  "Dictionary value must be of type dict or list.",
                  error_code=INVALID_PARAMETER_VALUE,
              )
  
          if not set(predict_methods).issubset(
              set(SUPPORTED_SKTIME_PREDICT_METHODS)
          ):
              raise MlflowException(
                  f"The provided {PYFUNC_PREDICT_CONF_KEY} values must be "
                  f"a subset of {SUPPORTED_SKTIME_PREDICT_METHODS}",
                  error_code=INVALID_PARAMETER_VALUE,
              )
  
          if SKTIME_PREDICT in predict_methods:
              raw_predictions[
                  SKTIME_PREDICT
              ] = self.sktime_model.predict(X=X)
  
          if SKTIME_PREDICT_INTERVAL in predict_methods:
              if predict_params:
                  coverage = (
                      0.9
                      if "coverage"
                      not in self.sktime_model.pyfunc_predict_conf[
                          PYFUNC_PREDICT_CONF_KEY
                      ][SKTIME_PREDICT_INTERVAL]
                      else self.sktime_model.pyfunc_predict_conf[
                          PYFUNC_PREDICT_CONF_KEY
                      ][SKTIME_PREDICT_INTERVAL]["coverage"]
                  )
              else:
                  coverage = 0.9
  
              raw_predictions[
                  SKTIME_PREDICT_INTERVAL
              ] = self.sktime_model.predict_interval(
                  X=X, coverage=coverage
              )
  
          if SKTIME_PREDICT_PROBA in predict_methods:
              if not isinstance(
                  self.sktime_model.pyfunc_predict_conf[
                      PYFUNC_PREDICT_CONF_KEY
                  ],
                  dict,
              ):
                  raise MlflowException(
                      f"Method {SKTIME_PREDICT_PROBA} requires passing a dictionary.",
                      error_code=INVALID_PARAMETER_VALUE,
                  )
  
              if (
                  "quantiles"
                  not in self.sktime_model.pyfunc_predict_conf[
                      PYFUNC_PREDICT_CONF_KEY
                  ][SKTIME_PREDICT_PROBA]
              ):
                  raise MlflowException(
                      f"Method {SKTIME_PREDICT_PROBA} requires passing "
                      f"quantile values.",
                      error_code=INVALID_PARAMETER_VALUE,
                  )
  
              quantiles = self.sktime_model.pyfunc_predict_conf[
                  PYFUNC_PREDICT_CONF_KEY
              ][SKTIME_PREDICT_PROBA]["quantiles"]
              marginal = (
                  True
                  if "marginal"
                  not in self.sktime_model.pyfunc_predict_conf[
                      PYFUNC_PREDICT_CONF_KEY
                  ][SKTIME_PREDICT_PROBA]
                  else self.sktime_model.pyfunc_predict_conf[
                      PYFUNC_PREDICT_CONF_KEY
                  ][SKTIME_PREDICT_PROBA]["marginal"]
              )
  
              y_pred_dist = self.sktime_model.predict_proba(
                  X=X, marginal=marginal
              )
              y_pred_dist_quantiles = y_pred_dist.quantile(quantiles)
              y_pred_dist_quantiles.columns = [
                  f"Quantiles_{q}" for q in quantiles
              ]
  
              raw_predictions[
                  SKTIME_PREDICT_PROBA
              ] = y_pred_dist_quantiles
  
          if SKTIME_PREDICT_QUANTILES in predict_methods:
              if predict_params:
                  alpha = (
                      None
                      if "alpha"
                      not in self.sktime_model.pyfunc_predict_conf[
                          PYFUNC_PREDICT_CONF_KEY
                      ][SKTIME_PREDICT_QUANTILES]
                      else self.sktime_model.pyfunc_predict_conf[
                          PYFUNC_PREDICT_CONF_KEY
                      ][SKTIME_PREDICT_QUANTILES]["alpha"]
                  )
              else:
                  alpha = None
              raw_predictions[
                  SKTIME_PREDICT_QUANTILES
              ] = self.sktime_model.predict_quantiles(X=X, alpha=alpha)
  
          if SKTIME_PREDICT_VAR in predict_methods:
              if predict_params:
                  cov = (
                      False
                      if "cov"
                      not in self.sktime_model.pyfunc_predict_conf[
                          PYFUNC_PREDICT_CONF_KEY
                      ][SKTIME_PREDICT_VAR]
                      else self.sktime_model.pyfunc_predict_conf[
                          PYFUNC_PREDICT_CONF_KEY
                      ][SKTIME_PREDICT_VAR]["cov"]
                  )
              else:
                  cov = False
              raw_predictions[
                  SKTIME_PREDICT_VAR
              ] = self.sktime_model.predict_var(X=X, cov=cov)
  
      for k, v in raw_predictions.items():
          if hasattr(v, "columns") and isinstance(
              v.columns, pd.MultiIndex
          ):
              raw_predictions[k].columns = flatten_multiindex(v)
  
      if len(raw_predictions) > 1:
          predictions = pd.concat(
              list(raw_predictions.values()),
              axis=1,
              keys=list(raw_predictions.keys()),
          )
          predictions.columns = flatten_multiindex(predictions)
      else:
          predictions = raw_predictions[list(raw_predictions.keys())[0]]
  
      return predictions
  
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 2 for calling the _SktimeModelWrapper obj's underlying member method code with example usage: obj.predict(X) and returns: predictions