class_docstr: Abstract base class for time series panel tasks, e.g., classifiers, regressors.
  
  The class contains boilerplate for checks and data conversions,
  which are common to multiple descendants, most importantly,
  BaseClassifier and BaseRegressor.
docstr: Check whether input X and y are valid formats with minimum data.
  
  Raises a ValueError if the input is not valid.
  
  Parameters
  ----------
  X : check whether conformant with any sktime Panel mtype specification
  y : check whether a pd.Series or np.array
  enforce_min_instances : int, optional (default=1)
      check there are a minimum number of instances.
  return_metadata : bool, str, or list of str
      metadata fields to return with X_metadata, input to check_is_scitype
  
  Returns
  -------
  metadata : dict with metadata for X returned by datatypes.check_is_scitype
  
  Raises
  ------
  ValueError
      If y or X is invalid input data type, or there is not enough data
docstr_tok: ["Check","whether","input","X","and","y","are","valid","formats","with","minimum","data",".","Raises","a","ValueError","if","the","input","is","not","valid",".","Parameters","--","--","--","--","--","X",":","check","whether","conformant","with","any","sktime","Panel","mtype","specification","y",":","check","whether","a","pd.Series","or","np.array","enforce_min_instances",":","int",",","optional","(","default=1",")","check","there","are","a","minimum","number","of","instances",".","return_metadata",":","bool",",","str",",","or","list","of","str","metadata","fields","to","return","with","X_metadata",",","input","to","check_is_scitype","Returns","--","--","--","-","metadata",":","dict","with","metadata","for","X","returned","by","datatypes.check_is_scitype","Raises","--","--","--","ValueError","If","y","or","X","is","invalid","input","data","type",",","or","there","is","not","enough","data"]
code: def _check_input(
      self, X, y=None, enforce_min_instances=1, return_metadata=True
  ):
      """Check whether input X and y are valid formats with minimum data.
  
      Raises a ValueError if the input is not valid.
  
      Parameters
      ----------
      X : check whether conformant with any sktime Panel mtype specification
      y : check whether a pd.Series or np.array
      enforce_min_instances : int, optional (default=1)
          check there are a minimum number of instances.
      return_metadata : bool, str, or list of str
          metadata fields to return with X_metadata, input to check_is_scitype
  
      Returns
      -------
      metadata : dict with metadata for X returned by datatypes.check_is_scitype
  
      Raises
      ------
      ValueError
          If y or X is invalid input data type, or there is not enough data
      """
      # Check X is valid input type and recover the data characteristics
      X_valid, msg, X_metadata = check_is_scitype(
          X, scitype="Panel", return_metadata=return_metadata
      )
      # raise informative error message if X is in wrong format
      allowed_msg = (
          f"Allowed scitypes for {self.EST_TYPE_PLURAL} are Panel mtypes, "
          f"for instance a pandas.DataFrame with MultiIndex and last(-1) "
          f"level an sktime compatible time index. "
          f"Allowed compatible mtype format specifications are: {MTYPE_LIST_PANEL} ."
      )
      if not X_valid:
          check_is_error_msg(
              msg,
              var_name="X",
              allowed_msg=allowed_msg,
              raise_exception=True,
          )
  
      n_cases = X_metadata["n_instances"]
      if n_cases < enforce_min_instances:
          raise ValueError(
              f"Minimum number of cases required is {enforce_min_instances} but X "
              f"has : {n_cases}"
          )
  
      # Check y if passed
      if y is not None:
          # Check y valid input
          if not isinstance(y, (pd.Series, pd.DataFrame, np.ndarray)):
              raise ValueError(
                  "y must be a np.array or a pd.Series or pd.DataFrame, but found ",
                  f"type: {type(y)}",
              )
          # Check matching number of labels
          n_labels = y.shape[0]
          if n_cases != n_labels:
              raise ValueError(
                  f"Mismatch in number of cases. Number in X = {n_cases} nos in y = "
                  f"{n_labels}"
              )
          if isinstance(y, np.ndarray):
              if y.ndim > 2:
                  raise ValueError(
                      f"np.ndarray y must be 1-dimensional or 2-dimensional, "
                      f"but found {y.ndim} dimensions"
                  )
          # warn if only a single class label is seen
          # this should not raise exception since this can occur by train subsampling
          if len(np.unique(y)) == 1:
              warn(
                  "only single label seen in y passed to "
                  f"fit of {self.EST_TYPE} {type(self).__name__}",
                  obj=self,
              )
  
      return X_metadata
  
file_path: sktime/sktime/base/_base_panel.py
imports: import numpy
  import pandas
  from sktime.base import BaseEstimator
  from sktime.datatypes import MTYPE_LIST_PANEL, MTYPE_LIST_TABLE, VectorizedDF, check_is_error_msg, check_is_scitype, convert
  from sktime.utils.warnings import warn
label_desc: Use image node_id 8 for calling the BasePanelMixin obj's underlying member method code with example usage: obj._check_input(X, y, enforce_min_instances, return_metadata) and returns: X_metadata