class_docstr: A survival tree.
  
  The quality of a split is measured by the
  log-rank splitting rule.
  
  If ``splitter='best'``, fit and predict methods support
  missing values. See :ref:`tree_missing_value_support` for details.
  
  See [1]_, [2]_ and [3]_ for further description.
  
  Parameters
  ----------
  splitter : {'best', 'random'}, default: 'best'
      The strategy used to choose the split at each node. Supported
      strategies are 'best' to choose the best split and 'random' to choose
      the best random split.
  
  max_depth : int or None, optional, default: None
      The maximum depth of the tree. If None, then nodes are expanded until
      all leaves are pure or until all leaves contain less than
      `min_samples_split` samples.
  
  min_samples_split : int, float, optional, default: 6
      The minimum number of samples required to split an internal node:
  
      - If int, then consider `min_samples_split` as the minimum number.
      - If float, then `min_samples_split` is a fraction and
        `ceil(min_samples_split * n_samples)` are the minimum
        number of samples for each split.
  
  min_samples_leaf : int, float, optional, default: 3
      The minimum number of samples required to be at a leaf node.
      A split point at any depth will only be considered if it leaves at
      least ``min_samples_leaf`` training samples in each of the left and
      right branches.  This may have the effect of smoothing the model,
      especially in regression.
  
      - If int, then consider `min_samples_leaf` as the minimum number.
      - If float, then `min_samples_leaf` is a fraction and
        `ceil(min_samples_leaf * n_samples)` are the minimum
        number of samples for each node.
  
  min_weight_fraction_leaf : float, optional, default: 0.
      The minimum weighted fraction of the sum total of weights (of all
      the input samples) required to be at a leaf node. Samples have
      equal weight when sample_weight is not provided.
  
  max_features : int, float, string or None, optional, default: None
      The number of features to consider when looking for the best split:
  
      - If int, then consider `max_features` features at each split.
      - If float, then `max_features` is a fraction and
        `max(1, int(max_features * n_features_in_))` features are considered at
        each split.
      - If "sqrt", then `max_features=sqrt(n_features)`.
      - If "log2", then `max_features=log2(n_features)`.
      - If None, then `max_features=n_features`.
  
      Note: the search for a split does not stop until at least one
      valid partition of the node samples is found, even if it requires to
      effectively inspect more than ``max_features`` features.
  
  random_state : int, RandomState instance or None, optional, default: None
      Controls the randomness of the estimator. The features are always
      randomly permuted at each split, even if ``splitter`` is set to
      ``"best"``. When ``max_features < n_features``, the algorithm will
      select ``max_features`` at random at each split before finding the best
      split among them. But the best found split may vary across different
      runs, even if ``max_features=n_features``. That is the case, if the
      improvement of the criterion is identical for several splits and one
      split has to be selected at random. To obtain a deterministic behavior
      during fitting, ``random_state`` has to be fixed to an integer.
  
  max_leaf_nodes : int or None, optional, default: None
      Grow a tree with ``max_leaf_nodes`` in best-first fashion.
      Best nodes are defined as relative reduction in impurity.
      If None then unlimited number of leaf nodes.
  
  low_memory : boolean, default: False
      If set, ``predict`` computations use reduced memory but ``predict_cumulative_hazard_function``
      and ``predict_survival_function`` are not implemented.
  
  Attributes
  ----------
  unique_times_ : array of shape = (n_unique_times,)
      Unique time points.
  
  max_features_ : int,
      The inferred value of max_features.
  
  n_features_in_ : int
      Number of features seen during ``fit``.
  
  feature_names_in_ : ndarray of shape (`n_features_in_`,)
      Names of features seen during ``fit``. Defined only when `X`
      has feature names that are all strings.
  
  tree_ : Tree object
      The underlying Tree object. Please refer to
      ``help(sklearn.tree._tree.Tree)`` for attributes of Tree object.
  
  See also
  --------
  sksurv.ensemble.RandomSurvivalForest
      An ensemble of SurvivalTrees.
  
  References
  ----------
  .. [1] Leblanc, M., & Crowley, J. (1993). Survival Trees by Goodness of Split.
         Journal of the American Statistical Association, 88(422), 457–467.
  
  .. [2] Ishwaran, H., Kogalur, U. B., Blackstone, E. H., & Lauer, M. S. (2008).
         Random survival forests. The Annals of Applied Statistics, 2(3), 841–860.
  
  .. [3] Ishwaran, H., Kogalur, U. B. (2007). Random survival forests for R.
         R News, 7(2), 25–31. https://cran.r-project.org/doc/Rnews/Rnews_2007-2.pdf.
class_docstr_tok: ["A","survival","tree",".","The","quality","of","a","split","is","measured","by","the","log-rank","splitting","rule",".","If","``","splitter='best","'","``",",","fit","and","predict","methods","support","missing","values",".","See",":","ref",":","`","tree_missing_value_support","`","for","details",".","See","[","1","]","_",",","[","2","]","_","and","[","3","]","_","for","further","description",".","Parameters","--","--","--","--","--","splitter",":","{","'best","'",",","'random","'","}",",","default",":","'best'","The","strategy","used","to","choose","the","split","at","each","node",".","Supported","strategies","are","'best","'","to","choose","the","best","split","and","'random","'","to","choose","the","best","random","split",".","max_depth",":","int","or","None",",","optional",",","default",":","None","The","maximum","depth","of","the","tree",".","If","None",",","then","nodes","are","expanded","until","all","leaves","are","pure","or","until","all","leaves","contain","less","than","`","min_samples_split","`","samples",".","min_samples_split",":","int",",","float",",","optional",",","default",":","6","The","minimum","number","of","samples","required","to","split","an","internal","node",":","-","If","int",",","then","consider","`","min_samples_split","`","as","the","minimum","number",".","-","If","float",",","then","`","min_samples_split","`","is","a","fraction","and","`","ceil","(","min_samples_split","*","n_samples",")","`","are","the","minimum","number","of","samples","for","each","split",".","min_samples_leaf",":","int",",","float",",","optional",",","default",":","3","The","minimum","number","of","samples","required","to","be","at","a","leaf","node",".","A","split","point","at","any","depth","will","only","be","considered","if","it","leaves","at","least","``","min_samples_leaf","``","training","samples","in","each","of","the","left","and","right","branches",".","This","may","have","the","effect","of","smoothing","the","model",",","especially","in","regression",".","-","If","int",",","then","consider","`","min_samples_leaf","`","as","the","minimum","number",".","-","If","float",",","then","`","min_samples_leaf","`","is","a","fraction","and","`","ceil","(","min_samples_leaf","*","n_samples",")","`","are","the","minimum","number","of","samples","for","each","node",".","min_weight_fraction_leaf",":","float",",","optional",",","default",":","0",".","The","minimum","weighted","fraction","of","the","sum","total","of","weights","(","of","all","the","input","samples",")","required","to","be","at","a","leaf","node",".","Samples","have","equal","weight","when","sample_weight","is","not","provided",".","max_features",":","int",",","float",",","string","or","None",",","optional",",","default",":","None","The","number","of","features","to","consider","when","looking","for","the","best","split",":","-","If","int",",","then","consider","`","max_features","`","features","at","each","split",".","-","If","float",",","then","`","max_features","`","is","a","fraction","and","`","max","(","1",",","int","(","max_features","*","n_features_in_",")",")","`","features","are","considered","at","each","split",".","-","If","``","sqrt","''",",","then","`","max_features=sqrt","(","n_features",")","`",".","-","If","``","log2","''",",","then","`","max_features=log2","(","n_features",")","`",".","-","If","None",",","then","`","max_features=n_features","`",".","Note",":","the","search","for","a","split","does","not","stop","until","at","least","one","valid","partition","of","the","node","samples","is","found",",","even","if","it","requires","to","effectively","inspect","more","than","``","max_features","``","features",".","random_state",":","int",",","RandomState","instance","or","None",",","optional",",","default",":","None","Controls","the","randomness","of","the","estimator",".","The","features","are","always","randomly","permuted","at","each","split",",","even","if","``","splitter","``","is","set","to","``","``","best","''","``",".","When","``","max_features","<","n_features","``",",","the","algorithm","will","select","``","max_features","``","at","random","at","each","split","before","finding","the","best","split","among","them",".","But","the","best","found","split","may","vary","across","different","runs",",","even","if","``","max_features=n_features","``",".","That","is","the","case",",","if","the","improvement","of","the","criterion","is","identical","for","several","splits","and","one","split","has","to","be","selected","at","random",".","To","obtain","a","deterministic","behavior","during","fitting",",","``","random_state","``","has","to","be","fixed","to","an","integer",".","max_leaf_nodes",":","int","or","None",",","optional",",","default",":","None","Grow","a","tree","with","``","max_leaf_nodes","``","in","best-first","fashion",".","Best","nodes","are","defined","as","relative","reduction","in","impurity",".","If","None","then","unlimited","number","of","leaf","nodes",".","low_memory",":","boolean",",","default",":","False","If","set",",","``","predict","``","computations","use","reduced","memory","but","``","predict_cumulative_hazard_function","``","and","``","predict_survival_function","``","are","not","implemented",".","Attributes","--","--","--","--","--","unique_times_",":","array","of","shape","=","(","n_unique_times",",",")","Unique","time","points",".","max_features_",":","int",",","The","inferred","value","of","max_features",".","n_features_in_",":","int","Number","of","features","seen","during","``","fit","``",".","feature_names_in_",":","ndarray","of","shape","(","`","n_features_in_","`",",",")","Names","of","features","seen","during","``","fit","``",".","Defined","only","when","`","X","`","has","feature","names","that","are","all","strings",".","tree_",":","Tree","object","The","underlying","Tree","object",".","Please","refer","to","``","help","(","sklearn.tree._tree.Tree",")","``","for","attributes","of","Tree","object",".","See","also","--","--","--","--","sksurv.ensemble.RandomSurvivalForest","An","ensemble","of","SurvivalTrees",".","References","--","--","--","--","--","..","[","1","]","Leblanc",",","M.",",","&","Crowley",",","J",".","(","1993",")",".","Survival","Trees","by","Goodness","of","Split",".","Journal","of","the","American","Statistical","Association",",","88","(","422",")",",","457\u2013467",".","..","[","2","]","Ishwaran",",","H.",",","Kogalur",",","U",".","B.",",","Blackstone",",","E.","H.",",","&","Lauer",",","M.","S.","(","2008",")",".","Random","survival","forests",".","The","Annals","of","Applied","Statistics",",","2","(","3",")",",","841\u2013860",".","..","[","3","]","Ishwaran",",","H.",",","Kogalur",",","U",".","B",".","(","2007",")",".","Random","survival","forests","for","R.","R","News",",","7","(","2",")",",","25\u201331",".","https",":","\/\/cran.r-project.org\/doc\/Rnews\/Rnews_2007-2.pdf","."]
docstr: Return the index of the leaf that each sample is predicted as.
  
  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``.
      If ``splitter='best'``, `X` is allowed to contain missing
      values and decisions are made as described in
      :ref:`tree_missing_value_support`.
  
  check_input : bool, 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: ["Return","the","index","of","the","leaf","that","each","sample","is","predicted","as",".","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","``",".","If","``","splitter='best","'","``",",","`","X","`","is","allowed","to","contain","missing","values","and","decisions","are","made","as","described","in",":","ref",":","`","tree_missing_value_support","`",".","check_input",":","bool",",","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):
      """Return the index of the leaf that each sample is predicted as.
  
      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``.
          If ``splitter='best'``, `X` is allowed to contain missing
          values and decisions are made as described in
          :ref:`tree_missing_value_support`.
  
      check_input : bool, 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.
      """
      check_is_fitted(self, "tree_")
      self._validate_X_predict(X, check_input)
      return self.tree_.apply(X)
  
imports: from math import ceil
  from numbers import Integral, Real
  import numpy
  from scipy.sparse import issparse
  from sklearn.base import BaseEstimator
  from sklearn.tree import _tree
  from sklearn.tree._classes import DENSE_SPLITTERS, SPARSE_SPLITTERS
  from sklearn.tree._splitter import Splitter
  from sklearn.tree._tree import BestFirstTreeBuilder, DepthFirstTreeBuilder, Tree
  from sklearn.tree._utils import _any_isnan_axis0
  from sklearn.utils._param_validation import Interval, StrOptions
  from sklearn.utils.validation import _assert_all_finite_element_wise, assert_all_finite, check_is_fitted, check_random_state
  from ..base import SurvivalAnalysisMixin
  from ..functions import StepFunction
  from ..util import check_array_survival
  from ._criterion import LogrankCriterion, get_unique_times
label_desc: Use image node_id 13 for calling the SurvivalTree obj's underlying member method code with example usage: obj.apply(X, check_input) and returns: self