parameters: (self, X)
return_statement: return leaves
docstring: Apply trees in the ensemble to X, return leaf indices.
  
          .. versionadded:: 0.17
  
          Parameters
          ----------
          X : array-like or sparse matrix, shape = [n_samples, n_features]
              The input samples. Internally, its dtype will be converted to
              ``dtype=np.float32``. If a sparse matrix is provided, it will
              be converted to a sparse ``csr_matrix``.
  
          Returns
          -------
          X_leaves : array_like, shape = [n_samples, n_estimators, n_classes]
              For each datapoint x in X and for each tree in the ensemble,
              return the index of the leaf x ends up in each estimator.
              In the case of binary classification n_classes is 1.
docstring_summary: Apply trees in the ensemble to X, return leaf indices.
docstring_tokens: Apply trees in the ensemble to X return leaf indices .
function: def apply(self, X):
          """Apply trees in the ensemble to X, return leaf indices.
  
          .. versionadded:: 0.17
  
          Parameters
          ----------
          X : array-like or sparse matrix, shape = [n_samples, n_features]
              The input samples. Internally, its dtype will be converted to
              ``dtype=np.float32``. If a sparse matrix is provided, it will
              be converted to a sparse ``csr_matrix``.
  
          Returns
          -------
          X_leaves : array_like, shape = [n_samples, n_estimators, n_classes]
              For each datapoint x in X and for each tree in the ensemble,
              return the index of the leaf x ends up in each estimator.
              In the case of binary classification n_classes is 1.
          """
  
          self._check_initialized()
          X = self.estimators_[0, 0]._validate_X_predict(X, check_input=True)
  
          # n_classes will be equal to 1 in the binary classification or the
          # regression case.
          n_estimators, n_classes = self.estimators_.shape
          leaves = np.zeros((X.shape[0], n_estimators, n_classes))
  
          for i in range(n_estimators):
              for j in range(n_classes):
                  estimator = self.estimators_[i, j]
                  leaves[:, i, j] = estimator.apply(X, check_input=False)
  
          return leaves
function_tokens: def apply ( self , X ) : self . _check_initialized ( ) X = self . estimators_ [ 0 , 0 ] . _validate_X_predict ( X , check_input = True ) # n_classes will be equal to 1 in the binary classification or the # regression case. n_estimators , n_classes = self . estimators_ . shape leaves = np . zeros ( ( X . shape [ 0 ] , n_estimators , n_classes ) ) for i in range ( n_estimators ) : for j in range ( n_classes ) : estimator = self . estimators_ [ i , j ] leaves [ : , i , j ] = estimator . apply ( X , check_input = False ) return leaves