class_docstr: Base class for decision trees.
  
  Warning: This class should not be used directly.
  Use derived classes instead.
class_docstr_tok: ["Base","class","for","decision","trees",".","Warning",":","This","class","should","not","be","used","directly",".","Use","derived","classes","instead","."]
docstr: Returns the index of the leaf that each sample is predicted as.
  
  .. versionadded:: 0.17
  
  Parameters
  ----------
  X : array_like or sparse matrix, shape = [n_samples, n_features]
      The input samples. Internally, it will be converted to
      ``dtype=np.float32`` and if a sparse matrix is provided
      to a sparse ``csr_matrix``.
  
  check_input : boolean, (default=True)
      Allow to bypass several input checking.
      Don't use this parameter unless you know what you do.
  
  Returns
  -------
  X_leaves : array_like, shape = [n_samples,]
      For each datapoint x in X, return the index of the leaf x
      ends up in. Leaves are numbered within
      ``[0; self.tree_.node_count)``, possibly with gaps in the
      numbering.
docstr_tok: ["Returns","the","index","of","the","leaf","that","each","sample","is","predicted","as",".","..","versionadded",":",":","0.17","Parameters","--","--","--","--","--","X",":","array_like","or","sparse","matrix",",","shape","=","[","n_samples",",","n_features","]","The","input","samples",".","Internally",",","it","will","be","converted","to","``","dtype=np.float32","``","and","if","a","sparse","matrix","is","provided","to","a","sparse","``","csr_matrix","``",".","check_input",":","boolean",",","(","default=True",")","Allow","to","bypass","several","input","checking",".","Do","n't","use","this","parameter","unless","you","know","what","you","do",".","Returns","--","--","--","-","X_leaves",":","array_like",",","shape","=","[","n_samples",",","]","For","each","datapoint","x","in","X",",","return","the","index","of","the","leaf","x","ends","up","in",".","Leaves","are","numbered","within","``","[","0",";","self.tree_.node_count",")","``",",","possibly","with","gaps","in","the","numbering","."]
code: def apply(self, X, check_input=True):
      """
      Returns the index of the leaf that each sample is predicted as.
  
      .. versionadded:: 0.17
  
      Parameters
      ----------
      X : array_like or sparse matrix, shape = [n_samples, n_features]
          The input samples. Internally, it will be converted to
          ``dtype=np.float32`` and if a sparse matrix is provided
          to a sparse ``csr_matrix``.
  
      check_input : boolean, (default=True)
          Allow to bypass several input checking.
          Don't use this parameter unless you know what you do.
  
      Returns
      -------
      X_leaves : array_like, shape = [n_samples,]
          For each datapoint x in X, return the index of the leaf x
          ends up in. Leaves are numbered within
          ``[0; self.tree_.node_count)``, possibly with gaps in the
          numbering.
      """
      X = self._validate_X_predict(X, check_input)
      return self.tree_.apply(X)
  
imports: from __future__ import division
  import numbers
  from abc import ABCMeta
  from abc import abstractmethod
  from math import ceil
  import numpy
  from scipy.sparse import issparse
  from ..base import BaseEstimator
  from ..base import ClassifierMixin
  from ..base import RegressorMixin
  from ..externals import six
  from ..feature_selection.from_model import _LearntSelectorMixin
  from ..utils import check_array
  from ..utils import check_random_state
  from ..utils import compute_sample_weight
  from ..utils.multiclass import check_classification_targets
  from ..exceptions import NotFittedError
  from ._criterion import Criterion
  from ._splitter import Splitter
  from ._tree import DepthFirstTreeBuilder
  from ._tree import BestFirstTreeBuilder
  from ._tree import Tree
  from .None import _tree, _splitter, _criterion
label_desc: Use image node_id 5 for calling the BaseDecisionTree obj's underlying member method code with example usage: obj.apply(X, check_input) and returns: self