docstr: Initialize Random Forest of CausalTreeRegressors
  
  Args:
      n_estimators: (int, default=100)
              Number of trees in the forest
      control_name: (str or int)
              Name of control group
      criterion: ({"causal_mse", "standard_mse"}, default="causal_mse"):
              Function to measure the quality of a split.
      alpha: (float)
              The confidence level alpha of the ATE estimate and ITE bootstrap estimates
      max_depth: (int, default=None)
              The maximum depth of the tree.
      min_samples_split: (int or float, default=2)
          The minimum number of samples required to split an internal node:
      min_samples_leaf: (int or float), default=100
          The minimum number of samples required to be at a leaf node.
      min_weight_fraction_leaf: (float, default=0.0)
          The minimum weighted fraction of the sum total of weights (of all
          the input samples) required to be at a leaf node.
      max_features: (int, float or {"auto", "sqrt", "log2"}, default=None)
          The number of features to consider when looking for the best split
      max_leaf_nodes: (int, default=None)
          Grow a tree with ``max_leaf_nodes`` in best-first fashion.
      min_impurity_decrease: (float, default=float("-inf")))
          A node will be split if this split induces a decrease of the impurity
          greater than or equal to this value.
      bootstrap : (bool, default=True)
          Whether bootstrap samples are used when building trees.
      oob_score : bool, default=False
          Whether to use out-of-bag samples to estimate the generalization score.
      n_jobs : int, default=None
              The number of jobs to run in parallel.
      random_state : (int, RandomState instance or None, default=None)
              Controls both the randomness of the bootstrapping of the samples used
              when building trees (if ``bootstrap=True``) and the sampling of the
              features to consider when looking for the best split at each node
              (if ``max_features < n_features``).
      verbose : (int, default=0)
              Controls the verbosity when fitting and predicting.
      warm_start : (bool, default=False)
              When set to ``True``, reuse the solution of the previous call to fit
              and add more estimators to the ensemble, otherwise, just fit a whole
              new forest.
      ccp_alpha : (non-negative float, default=0.0)
              Complexity parameter used for Minimal Cost-Complexity Pruning.
      groups_penalty: (float, default=0.5)
              This penalty coefficient manages the node impurity increase in case of the difference between
              treatment and control samples sizes.
      max_samples : (int or float, default=None)
              If bootstrap is True, the number of samples to draw from X
              to train each base estimator.
      groups_cnt: (bool), count treatment and control groups for each node/leaf
docstr_tok: ["Initialize","Random","Forest","of","CausalTreeRegressors","Args",":","n_estimators",":","(","int",",","default=100",")","Number","of","trees","in","the","forest","control_name",":","(","str","or","int",")","Name","of","control","group","criterion",":","(","{","``","causal_mse","''",",","``","standard_mse","''","}",",","default=","''","causal_mse","''",")",":","Function","to","measure","the","quality","of","a","split",".","alpha",":","(","float",")","The","confidence","level","alpha","of","the","ATE","estimate","and","ITE","bootstrap","estimates","max_depth",":","(","int",",","default=None",")","The","maximum","depth","of","the","tree",".","min_samples_split",":","(","int","or","float",",","default=2",")","The","minimum","number","of","samples","required","to","split","an","internal","node",":","min_samples_leaf",":","(","int","or","float",")",",","default=100","The","minimum","number","of","samples","required","to","be","at","a","leaf","node",".","min_weight_fraction_leaf",":","(","float",",","default=0.0",")","The","minimum","weighted","fraction","of","the","sum","total","of","weights","(","of","all","the","input","samples",")","required","to","be","at","a","leaf","node",".","max_features",":","(","int",",","float","or","{","``","auto","''",",","``","sqrt","''",",","``","log2","''","}",",","default=None",")","The","number","of","features","to","consider","when","looking","for","the","best","split","max_leaf_nodes",":","(","int",",","default=None",")","Grow","a","tree","with","``","max_leaf_nodes","``","in","best-first","fashion",".","min_impurity_decrease",":","(","float",",","default=float","(","``","-inf","''",")",")",")","A","node","will","be","split","if","this","split","induces","a","decrease","of","the","impurity","greater","than","or","equal","to","this","value",".","bootstrap",":","(","bool",",","default=True",")","Whether","bootstrap","samples","are","used","when","building","trees",".","oob_score",":","bool",",","default=False","Whether","to","use","out-of-bag","samples","to","estimate","the","generalization","score",".","n_jobs",":","int",",","default=None","The","number","of","jobs","to","run","in","parallel",".","random_state",":","(","int",",","RandomState","instance","or","None",",","default=None",")","Controls","both","the","randomness","of","the","bootstrapping","of","the","samples","used","when","building","trees","(","if","``","bootstrap=True","``",")","and","the","sampling","of","the","features","to","consider","when","looking","for","the","best","split","at","each","node","(","if","``","max_features","<","n_features","``",")",".","verbose",":","(","int",",","default=0",")","Controls","the","verbosity","when","fitting","and","predicting",".","warm_start",":","(","bool",",","default=False",")","When","set","to","``","True","``",",","reuse","the","solution","of","the","previous","call","to","fit","and","add","more","estimators","to","the","ensemble",",","otherwise",",","just","fit","a","whole","new","forest",".","ccp_alpha",":","(","non-negative","float",",","default=0.0",")","Complexity","parameter","used","for","Minimal","Cost-Complexity","Pruning",".","groups_penalty",":","(","float",",","default=0.5",")","This","penalty","coefficient","manages","the","node","impurity","increase","in","case","of","the","difference","between","treatment","and","control","samples","sizes",".","max_samples",":","(","int","or","float",",","default=None",")","If","bootstrap","is","True",",","the","number","of","samples","to","draw","from","X","to","train","each","base","estimator",".","groups_cnt",":","(","bool",")",",","count","treatment","and","control","groups","for","each","node\/leaf"]
code: def __init__(
      self,
      n_estimators: int = 100,
      *,
      control_name: Union[int, str] = 0,
      criterion: str = "causal_mse",
      alpha: float = 0.05,
      max_depth: int = None,
      min_samples_split: int = 60,
      min_samples_leaf: int = 100,
      min_weight_fraction_leaf: float = 0.0,
      max_features: Union[int, float, str] = 1.0,
      max_leaf_nodes: int = None,
      min_impurity_decrease: float = float("-inf"),
      bootstrap: bool = True,
      oob_score: bool = False,
      n_jobs: int = None,
      random_state: int = None,
      verbose: int = 0,
      warm_start: bool = False,
      ccp_alpha: float = 0.0,
      groups_penalty: float = 0.5,
      max_samples: int = None,
      groups_cnt: bool = True,
  ):
      """
      Initialize Random Forest of CausalTreeRegressors
  
      Args:
          n_estimators: (int, default=100)
                  Number of trees in the forest
          control_name: (str or int)
                  Name of control group
          criterion: ({"causal_mse", "standard_mse"}, default="causal_mse"):
                  Function to measure the quality of a split.
          alpha: (float)
                  The confidence level alpha of the ATE estimate and ITE bootstrap estimates
          max_depth: (int, default=None)
                  The maximum depth of the tree.
          min_samples_split: (int or float, default=2)
              The minimum number of samples required to split an internal node:
          min_samples_leaf: (int or float), default=100
              The minimum number of samples required to be at a leaf node.
          min_weight_fraction_leaf: (float, default=0.0)
              The minimum weighted fraction of the sum total of weights (of all
              the input samples) required to be at a leaf node.
          max_features: (int, float or {"auto", "sqrt", "log2"}, default=None)
              The number of features to consider when looking for the best split
          max_leaf_nodes: (int, default=None)
              Grow a tree with ``max_leaf_nodes`` in best-first fashion.
          min_impurity_decrease: (float, default=float("-inf")))
              A node will be split if this split induces a decrease of the impurity
              greater than or equal to this value.
          bootstrap : (bool, default=True)
              Whether bootstrap samples are used when building trees.
          oob_score : bool, default=False
              Whether to use out-of-bag samples to estimate the generalization score.
          n_jobs : int, default=None
                  The number of jobs to run in parallel.
          random_state : (int, RandomState instance or None, default=None)
                  Controls both the randomness of the bootstrapping of the samples used
                  when building trees (if ``bootstrap=True``) and the sampling of the
                  features to consider when looking for the best split at each node
                  (if ``max_features < n_features``).
          verbose : (int, default=0)
                  Controls the verbosity when fitting and predicting.
          warm_start : (bool, default=False)
                  When set to ``True``, reuse the solution of the previous call to fit
                  and add more estimators to the ensemble, otherwise, just fit a whole
                  new forest.
          ccp_alpha : (non-negative float, default=0.0)
                  Complexity parameter used for Minimal Cost-Complexity Pruning.
          groups_penalty: (float, default=0.5)
                  This penalty coefficient manages the node impurity increase in case of the difference between
                  treatment and control samples sizes.
          max_samples : (int or float, default=None)
                  If bootstrap is True, the number of samples to draw from X
                  to train each base estimator.
          groups_cnt: (bool), count treatment and control groups for each node/leaf
      """
      self._estimator = CausalTreeRegressor(
          control_name=control_name,
          criterion=criterion,
          groups_cnt=groups_cnt,
      )
      _estimator_key = (
          "estimator"
          if Version(sklearn_version) >= Version("1.2.0")
          else "base_estimator"
      )
      _parent_args = {
          _estimator_key: self._estimator,
          "n_estimators": n_estimators,
          "estimator_params": (
              "criterion",
              "control_name",
              "max_depth",
              "min_samples_split",
              "min_weight_fraction_leaf",
              "max_features",
              "max_leaf_nodes",
              "min_impurity_decrease",
              "ccp_alpha",
              "groups_penalty",
              "min_samples_leaf",
              "random_state",
          ),
          "bootstrap": bootstrap,
          "oob_score": oob_score,
          "n_jobs": n_jobs,
          "random_state": random_state,
          "verbose": verbose,
          "warm_start": warm_start,
          "max_samples": max_samples,
      }
  
      super().__init__(**_parent_args)
  
      self.criterion = criterion
      self.control_name = control_name
      self.max_depth = max_depth
      self.min_samples_split = min_samples_split
      self.min_samples_leaf = min_samples_leaf
      self.min_weight_fraction_leaf = min_weight_fraction_leaf
      self.max_features = max_features
      self.max_leaf_nodes = max_leaf_nodes
      self.min_impurity_decrease = min_impurity_decrease
      self.ccp_alpha = ccp_alpha
      self.groups_penalty = groups_penalty
      self.alpha = alpha
      self.groups_cnt = groups_cnt
  
imports: from typing import Union
  import numpy
  import forestci
  from joblib import Parallel, delayed
  from warnings import catch_warnings, simplefilter, warn
  from sklearn.exceptions import DataConversionWarning
  from sklearn.utils.validation import check_random_state, _check_sample_weight
  from sklearn.utils.multiclass import type_of_target
  from sklearn import __version__
  from sklearn.ensemble._forest import DOUBLE, DTYPE, MAX_INT
  from sklearn.ensemble._forest import ForestRegressor
  from sklearn.ensemble._forest import compute_sample_weight, issparse
  from sklearn.ensemble._forest import _generate_sample_indices, _get_n_samples_bootstrap
  from .causaltree import CausalTreeRegressor
label_desc: Use image node_id 1 to create a new CausalRandomForestRegressor object from inherited base classes: ForestRegressor with example: obj = CausalRandomForestRegressor(n_estimators)