class_docstr: Tree grower class used to build a tree.
  
  The tree is fitted to predict the values of a Newton-Raphson step. The
  splits are considered in a best-first fashion, and the quality of a
  split is defined in splitting._split_gain.
  
  Parameters
  ----------
  X_binned : ndarray of shape (n_samples, n_features), dtype=np.uint8
      The binned input samples. Must be Fortran-aligned.
  gradients : ndarray of shape (n_samples,)
      The gradients of each training sample. Those are the gradients of the
      loss w.r.t the predictions, evaluated at iteration ``i - 1``.
  hessians : ndarray of shape (n_samples,)
      The hessians of each training sample. Those are the hessians of the
      loss w.r.t the predictions, evaluated at iteration ``i - 1``.
  max_leaf_nodes : int, default=None
      The maximum number of leaves for each tree. If None, there is no
      maximum limit.
  max_depth : int, default=None
      The maximum depth of each tree. The depth of a tree is the number of
      edges to go from the root to the deepest leaf.
      Depth isn't constrained by default.
  min_samples_leaf : int, default=20
      The minimum number of samples per leaf.
  min_gain_to_split : float, default=0.
      The minimum gain needed to split a node. Splits with lower gain will
      be ignored.
  min_hessian_to_split : float, default=1e-3
      The minimum sum of hessians needed in each node. Splits that result in
      at least one child having a sum of hessians less than
      ``min_hessian_to_split`` are discarded.
  n_bins : int, default=256
      The total number of bins, including the bin for missing values. Used
      to define the shape of the histograms.
  n_bins_non_missing : ndarray, dtype=np.uint32, default=None
      For each feature, gives the number of bins actually used for
      non-missing values. For features with a lot of unique values, this
      is equal to ``n_bins - 1``. If it's an int, all features are
      considered to have the same number of bins. If None, all features
      are considered to have ``n_bins - 1`` bins.
  has_missing_values : bool or ndarray, dtype=bool, default=False
      Whether each feature contains missing values (in the training data).
      If it's a bool, the same value is used for all features.
  is_categorical : ndarray of bool of shape (n_features,), default=None
      Indicates categorical features.
  monotonic_cst : array-like of int of shape (n_features,), dtype=int, default=None
      Indicates the monotonic constraint to enforce on each feature.
        - 1: monotonic increase
        - 0: no constraint
        - -1: monotonic decrease
  
      Read more in the :ref:`User Guide <monotonic_cst_gbdt>`.
  interaction_cst : list of sets of integers, default=None
      List of interaction constraints.
  l2_regularization : float, default=0.
      The L2 regularization parameter.
  feature_fraction_per_split : float, default=1
      Proportion of randomly chosen features in each and every node split.
      This is a form of regularization, smaller values make the trees weaker
      learners and might prevent overfitting.
  rng : Generator
      Numpy random Generator used for feature subsampling.
  shrinkage : float, default=1.
      The shrinkage parameter to apply to the leaves values, also known as
      learning rate.
  n_threads : int, default=None
      Number of OpenMP threads to use. `_openmp_effective_n_threads` is called
      to determine the effective number of threads use, which takes cgroups CPU
      quotes into account. See the docstring of `_openmp_effective_n_threads`
      for details.
  
  Attributes
  ----------
  histogram_builder : HistogramBuilder
  splitter : Splitter
  root : TreeNode
  finalized_leaves : list of TreeNode
  splittable_nodes : list of TreeNode
  missing_values_bin_idx : int
      Equals n_bins - 1
  n_categorical_splits : int
  n_features : int
  n_nodes : int
  total_find_split_time : float
      Time spent finding the best splits
  total_compute_hist_time : float
      Time spent computing histograms
  total_apply_split_time : float
      Time spent splitting nodes
  with_monotonic_cst : bool
      Whether there are monotonic constraints that apply. False iff monotonic_cst is
      None.
class_docstr_tok: ["Tree","grower","class","used","to","build","a","tree",".","The","tree","is","fitted","to","predict","the","values","of","a","Newton-Raphson","step",".","The","splits","are","considered","in","a","best-first","fashion",",","and","the","quality","of","a","split","is","defined","in","splitting._split_gain",".","Parameters","--","--","--","--","--","X_binned",":","ndarray","of","shape","(","n_samples",",","n_features",")",",","dtype=np.uint8","The","binned","input","samples",".","Must","be","Fortran-aligned",".","gradients",":","ndarray","of","shape","(","n_samples",",",")","The","gradients","of","each","training","sample",".","Those","are","the","gradients","of","the","loss","w.r.t","the","predictions",",","evaluated","at","iteration","``","i","-","1","``",".","hessians",":","ndarray","of","shape","(","n_samples",",",")","The","hessians","of","each","training","sample",".","Those","are","the","hessians","of","the","loss","w.r.t","the","predictions",",","evaluated","at","iteration","``","i","-","1","``",".","max_leaf_nodes",":","int",",","default=None","The","maximum","number","of","leaves","for","each","tree",".","If","None",",","there","is","no","maximum","limit",".","max_depth",":","int",",","default=None","The","maximum","depth","of","each","tree",".","The","depth","of","a","tree","is","the","number","of","edges","to","go","from","the","root","to","the","deepest","leaf",".","Depth","is","n't","constrained","by","default",".","min_samples_leaf",":","int",",","default=20","The","minimum","number","of","samples","per","leaf",".","min_gain_to_split",":","float",",","default=0",".","The","minimum","gain","needed","to","split","a","node",".","Splits","with","lower","gain","will","be","ignored",".","min_hessian_to_split",":","float",",","default=1e-3","The","minimum","sum","of","hessians","needed","in","each","node",".","Splits","that","result","in","at","least","one","child","having","a","sum","of","hessians","less","than","``","min_hessian_to_split","``","are","discarded",".","n_bins",":","int",",","default=256","The","total","number","of","bins",",","including","the","bin","for","missing","values",".","Used","to","define","the","shape","of","the","histograms",".","n_bins_non_missing",":","ndarray",",","dtype=np.uint32",",","default=None","For","each","feature",",","gives","the","number","of","bins","actually","used","for","non-missing","values",".","For","features","with","a","lot","of","unique","values",",","this","is","equal","to","``","n_bins","-","1","``",".","If","it","'s","an","int",",","all","features","are","considered","to","have","the","same","number","of","bins",".","If","None",",","all","features","are","considered","to","have","``","n_bins","-","1","``","bins",".","has_missing_values",":","bool","or","ndarray",",","dtype=bool",",","default=False","Whether","each","feature","contains","missing","values","(","in","the","training","data",")",".","If","it","'s","a","bool",",","the","same","value","is","used","for","all","features",".","is_categorical",":","ndarray","of","bool","of","shape","(","n_features",",",")",",","default=None","Indicates","categorical","features",".","monotonic_cst",":","array-like","of","int","of","shape","(","n_features",",",")",",","dtype=int",",","default=None","Indicates","the","monotonic","constraint","to","enforce","on","each","feature",".","-","1",":","monotonic","increase","-","0",":","no","constraint","-","-1",":","monotonic","decrease","Read","more","in","the",":","ref",":","`","User","Guide","<","monotonic_cst_gbdt",">","`",".","interaction_cst",":","list","of","sets","of","integers",",","default=None","List","of","interaction","constraints",".","l2_regularization",":","float",",","default=0",".","The","L2","regularization","parameter",".","feature_fraction_per_split",":","float",",","default=1","Proportion","of","randomly","chosen","features","in","each","and","every","node","split",".","This","is","a","form","of","regularization",",","smaller","values","make","the","trees","weaker","learners","and","might","prevent","overfitting",".","rng",":","Generator","Numpy","random","Generator","used","for","feature","subsampling",".","shrinkage",":","float",",","default=1",".","The","shrinkage","parameter","to","apply","to","the","leaves","values",",","also","known","as","learning","rate",".","n_threads",":","int",",","default=None","Number","of","OpenMP","threads","to","use",".","`","_openmp_effective_n_threads","`","is","called","to","determine","the","effective","number","of","threads","use",",","which","takes","cgroups","CPU","quotes","into","account",".","See","the","docstring","of","`","_openmp_effective_n_threads","`","for","details",".","Attributes","--","--","--","--","--","histogram_builder",":","HistogramBuilder","splitter",":","Splitter","root",":","TreeNode","finalized_leaves",":","list","of","TreeNode","splittable_nodes",":","list","of","TreeNode","missing_values_bin_idx",":","int","Equals","n_bins","-","1","n_categorical_splits",":","int","n_features",":","int","n_nodes",":","int","total_find_split_time",":","float","Time","spent","finding","the","best","splits","total_compute_hist_time",":","float","Time","spent","computing","histograms","total_apply_split_time",":","float","Time","spent","splitting","nodes","with_monotonic_cst",":","bool","Whether","there","are","monotonic","constraints","that","apply",".","False","iff","monotonic_cst","is","None","."]
docstr: Transform all splittable nodes into leaves.
  
  Used when some constraint is met e.g. maximum number of leaves or
  maximum depth.
docstr_tok: ["Transform","all","splittable","nodes","into","leaves",".","Used","when","some","constraint","is","met","e.g",".","maximum","number","of","leaves","or","maximum","depth","."]
code: def _finalize_splittable_nodes(self):
      """Transform all splittable nodes into leaves.
  
      Used when some constraint is met e.g. maximum number of leaves or
      maximum depth."""
      while len(self.splittable_nodes) > 0:
          node = self.splittable_nodes.pop()
          self._finalize_leaf(node)
  
imports: import numbers
  from heapq import heappop, heappush
  from timeit import default_timer
  import numpy
  from sklearn.utils._openmp_helpers import _openmp_effective_n_threads
  from ._bitset import set_raw_bitset_from_binned_bitset
  from .common import PREDICTOR_RECORD_DTYPE, X_BITSET_INNER_DTYPE, Y_DTYPE, MonotonicConstraint
  from .histogram import HistogramBuilder
  from .predictor import TreePredictor
  from .splitting import Splitter
  from .utils import sum_parallel
label_desc: Use image node_id 10 for calling the TreeGrower obj's underlying member method code with example usage: obj._finalize_splittable_nodes() without return types