class_docstr: Base class providing API and common functions for all multi-label
  classifiers.
  
  Implements base functionality for ML classifiers, especially the get/set params for
  scikit-learn compatibility.
  
  Attributes
  ----------
  copyable_attrs : List[str]
      list of attribute names that should be copied when class is cloned
docstr: Ensure the desired input format
  
  This function ensures that input format follows the
  density/sparsity requirements of base classifier.
  
  Parameters
  ----------
  X : array-like or sparse matrix
      An input feature matrix of shape :code:`(n_samples, n_features)`
  sparse_format: str
      Requested format of returned scipy.sparse matrix, if sparse is returned
  enforce_sparse : bool
      Ignore require_dense and enforce sparsity, useful internally
  
  Returns
  -------
  array-like or sparse matrix
      Transformed X values of shape :code:`(n_samples, n_features)`
  
  .. note:: If :code:`require_dense` was set to :code:`True` for
      input features in the constructor, the returned value is an
      array-like of array-likes. If :code:`require_dense` is
      set to :code:`false`, a sparse matrix of format
      :code:`sparse_format` is returned, if possible - without cloning.
docstr_tok: ["Ensure","the","desired","input","format","This","function","ensures","that","input","format","follows","the","density\/sparsity","requirements","of","base","classifier",".","Parameters","--","--","--","--","--","X",":","array-like","or","sparse","matrix","An","input","feature","matrix","of","shape",":","code",":","`","(","n_samples",",","n_features",")","`","sparse_format",":","str","Requested","format","of","returned","scipy.sparse","matrix",",","if","sparse","is","returned","enforce_sparse",":","bool","Ignore","require_dense","and","enforce","sparsity",",","useful","internally","Returns","--","--","--","-","array-like","or","sparse","matrix","Transformed","X","values","of","shape",":","code",":","`","(","n_samples",",","n_features",")","`","..","note",":",":","If",":","code",":","`","require_dense","`","was","set","to",":","code",":","`","True","`","for","input","features","in","the","constructor",",","the","returned","value","is","an","array-like","of","array-likes",".","If",":","code",":","`","require_dense","`","is","set","to",":","code",":","`","false","`",",","a","sparse","matrix","of","format",":","code",":","`","sparse_format","`","is","returned",",","if","possible","-","without","cloning","."]
code: def _ensure_input_format(
      self, X, sparse_format="csr", enforce_sparse=False
  ):
      """Ensure the desired input format
  
      This function ensures that input format follows the
      density/sparsity requirements of base classifier.
  
      Parameters
      ----------
      X : array-like or sparse matrix
          An input feature matrix of shape :code:`(n_samples, n_features)`
      sparse_format: str
          Requested format of returned scipy.sparse matrix, if sparse is returned
      enforce_sparse : bool
          Ignore require_dense and enforce sparsity, useful internally
  
      Returns
      -------
      array-like or sparse matrix
          Transformed X values of shape :code:`(n_samples, n_features)`
  
      .. note:: If :code:`require_dense` was set to :code:`True` for
          input features in the constructor, the returned value is an
          array-like of array-likes. If :code:`require_dense` is
          set to :code:`false`, a sparse matrix of format
          :code:`sparse_format` is returned, if possible - without cloning.
      """
      is_sparse = issparse(X)
  
      if is_sparse:
          if self.require_dense[0] and not enforce_sparse:
              return X.toarray()
          else:
              if sparse_format is None:
                  return X
              else:
                  return get_matrix_in_format(X, sparse_format)
      else:
          if self.require_dense[0] and not enforce_sparse:
              # TODO: perhaps a check_array?
              return X
          else:
              return matrix_creation_function_for_format(sparse_format)(
                  X
              )
  
file_path: scikit-multilearn/skmultilearn/base/base.py
imports: import numpy
  from ..utils import get_matrix_in_format, matrix_creation_function_for_format
  from scipy.sparse import issparse
  from sklearn.base import BaseEstimator, ClassifierMixin
label_desc: Use image node_id 3 for calling the MLClassifierBase obj's underlying member method code with example usage: obj._ensure_input_format(X, sparse_format, enforce_sparse) and returns: X, X, matrix_creation_function_for_format, X, get_matrix_in_format