class_docstr: Adaptive Random Forest classifier.
  
  The 3 most important aspects of Adaptive Random Forest [^1] are:
  
  1. inducing diversity through re-sampling
  
  2. inducing diversity through randomly selecting subsets of features for
     node splits
  
  3. drift detectors per base tree, which cause selective resets in response
     to drifts
  
  It also allows training background trees, which start training if a
  warning is detected and replace the active tree if the warning escalates
  to a drift.
  
  Parameters
  ----------
  n_models
      Number of trees in the ensemble.
  max_features
      Max number of attributes for each node split.<br/>
      - If `int`, then consider `max_features` at each split.<br/>
      - If `float`, then `max_features` is a percentage and
        `int(max_features * n_features)` features are considered per split.<br/>
      - If "sqrt", then `max_features=sqrt(n_features)`.<br/>
      - If "log2", then `max_features=log2(n_features)`.<br/>
      - If None, then ``max_features=n_features``.
  lambda_value
      The lambda value for bagging (lambda=6 corresponds to Leveraging Bagging).
  metric
      Metric used to track trees performance within the ensemble.
      Defaults to `metrics.Accuracy()`.
  disable_weighted_vote
      If `True`, disables the weighted vote prediction.
  drift_detector
      Drift Detection method. Set to None to disable Drift detection.
      Defaults to `drift.ADWIN(delta=0.001)`.
  warning_detector
      Warning Detection method. Set to None to disable warning detection.
      Defaults to `drift.ADWIN(delta=0.01)`.
  grace_period
      [*Tree parameter*] Number of instances a leaf should observe between
      split attempts.
  max_depth
      [*Tree parameter*] The maximum depth a tree can reach. If `None`, the
      tree will grow indefinitely.
  split_criterion
      [*Tree parameter*] Split criterion to use.<br/>
      - 'gini' - Gini<br/>
      - 'info_gain' - Information Gain<br/>
      - 'hellinger' - Hellinger Distance
  delta
      [*Tree parameter*] Allowed error in split decision, a value closer to 0
      takes longer to decide.
  tau
      [*Tree parameter*] Threshold below which a split will be forced to break
      ties.
  leaf_prediction
      [*Tree parameter*] Prediction mechanism used at leafs.<br/>
      - 'mc' - Majority Class<br/>
      - 'nb' - Naive Bayes<br/>
      - 'nba' - Naive Bayes Adaptive
  nb_threshold
      [*Tree parameter*] Number of instances a leaf should observe before
      allowing Naive Bayes.
  nominal_attributes
      [*Tree parameter*] List of Nominal attributes. If empty, then assume that
      all attributes are numerical.
  splitter
      [*Tree parameter*] The Splitter or Attribute Observer (AO) used to monitor the class
      statistics of numeric features and perform splits. Splitters are available in the
      `tree.splitter` module. Different splitters are available for classification and
      regression tasks. Classification and regression splitters can be distinguished by their
      property `is_target_class`. This is an advanced option. Special care must be taken when
      choosing different splitters. By default, `tree.splitter.GaussianSplitter` is used
      if `splitter` is `None`.
  binary_split
      [*Tree parameter*] If True, only allow binary splits.
  min_branch_fraction
      [*Tree parameter*] The minimum percentage of observed data required for branches
      resulting from split candidates. To validate a split candidate, at least two resulting
      branches must have a percentage of samples greater than `min_branch_fraction`. This
      criterion prevents unnecessary splits when the majority of instances are concentrated
      in a single branch.
  max_share_to_split
      [*Tree parameter*] Only perform a split in a leaf if the proportion of elements
      in the majority class is smaller than this parameter value. This parameter avoids
      performing splits when most of the data belongs to a single class.
  max_size
      [*Tree parameter*] Maximum memory (MB) consumed by the tree.
  memory_estimate_period
      [*Tree parameter*] Number of instances between memory consumption checks.
  stop_mem_management
      [*Tree parameter*] If True, stop growing as soon as memory limit is hit.
  remove_poor_attrs
      [*Tree parameter*] If True, disable poor attributes to reduce memory usage.
  merit_preprune
      [*Tree parameter*] If True, enable merit-based tree pre-pruning.
  seed
      Random seed for reproducibility.
  
  Examples
  --------
  
  >>> from river import evaluate
  >>> from river import forest
  >>> from river import metrics
  >>> from river.datasets import synth
  
  >>> dataset = synth.ConceptDriftStream(
  ...     seed=42,
  ...     position=500,
  ...     width=40
  ... ).take(1000)
  
  >>> model = forest.ARFClassifier(seed=8, leaf_prediction="mc")
  
  >>> metric = metrics.Accuracy()
  
  >>> evaluate.progressive_val_score(dataset, model, metric)
  Accuracy: 71.17%
  
  The total number of warnings and drifts detected, respectively
  >>> model.n_warnings_detected(), model.n_drifts_detected()
  (2, 1)
  
  The number of warnings detected by tree number 2
  >>> model.n_warnings_detected(2)
  1
  
  And the corresponding number of actual concept drift detected
  >>> model.n_drifts_detected(2)
  1
  
  References
  ----------
  [^1]: Heitor Murilo Gomes, Albert Bifet, Jesse Read, Jean Paul Barddal,
       Fabricio Enembreck, Bernhard Pfharinger, Geoff Holmes, Talel Abdessalem.
       Adaptive random forests for evolving data stream classification.
       In Machine Learning, DOI: 10.1007/s10994-017-5642-8, Springer, 2017.
class_docstr_tok: ["Adaptive","Random","Forest","classifier",".","The","3","most","important","aspects","of","Adaptive","Random","Forest","[","^1","]","are",":","1.","inducing","diversity","through","re-sampling","2.","inducing","diversity","through","randomly","selecting","subsets","of","features","for","node","splits","3.","drift","detectors","per","base","tree",",","which","cause","selective","resets","in","response","to","drifts","It","also","allows","training","background","trees",",","which","start","training","if","a","warning","is","detected","and","replace","the","active","tree","if","the","warning","escalates","to","a","drift",".","Parameters","--","--","--","--","--","n_models","Number","of","trees","in","the","ensemble",".","max_features","Max","number","of","attributes","for","each","node","split.","<","br\/",">","-","If","`","int","`",",","then","consider","`","max_features","`","at","each","split.","<","br\/",">","-","If","`","float","`",",","then","`","max_features","`","is","a","percentage","and","`","int","(","max_features","*","n_features",")","`","features","are","considered","per","split.","<","br\/",">","-","If","``","sqrt","''",",","then","`","max_features=sqrt","(","n_features",")","`",".","<","br\/",">","-","If","``","log2","''",",","then","`","max_features=log2","(","n_features",")","`",".","<","br\/",">","-","If","None",",","then","``","max_features=n_features","``",".","lambda_value","The","lambda","value","for","bagging","(","lambda=6","corresponds","to","Leveraging","Bagging",")",".","metric","Metric","used","to","track","trees","performance","within","the","ensemble",".","Defaults","to","`","metrics.Accuracy","(",")","`",".","disable_weighted_vote","If","`","True","`",",","disables","the","weighted","vote","prediction",".","drift_detector","Drift","Detection","method",".","Set","to","None","to","disable","Drift","detection",".","Defaults","to","`","drift.ADWIN","(","delta=0.001",")","`",".","warning_detector","Warning","Detection","method",".","Set","to","None","to","disable","warning","detection",".","Defaults","to","`","drift.ADWIN","(","delta=0.01",")","`",".","grace_period","[","*","Tree","parameter","*","]","Number","of","instances","a","leaf","should","observe","between","split","attempts",".","max_depth","[","*","Tree","parameter","*","]","The","maximum","depth","a","tree","can","reach",".","If","`","None","`",",","the","tree","will","grow","indefinitely",".","split_criterion","[","*","Tree","parameter","*","]","Split","criterion","to","use.","<","br\/",">","-","'gini","'","-","Gini","<","br\/",">","-","'info_gain","'","-","Information","Gain","<","br\/",">","-","'hellinger","'","-","Hellinger","Distance","delta","[","*","Tree","parameter","*","]","Allowed","error","in","split","decision",",","a","value","closer","to","0","takes","longer","to","decide",".","tau","[","*","Tree","parameter","*","]","Threshold","below","which","a","split","will","be","forced","to","break","ties",".","leaf_prediction","[","*","Tree","parameter","*","]","Prediction","mechanism","used","at","leafs.","<","br\/",">","-","'mc","'","-","Majority","Class","<","br\/",">","-","'nb","'","-","Naive","Bayes","<","br\/",">","-","'nba","'","-","Naive","Bayes","Adaptive","nb_threshold","[","*","Tree","parameter","*","]","Number","of","instances","a","leaf","should","observe","before","allowing","Naive","Bayes",".","nominal_attributes","[","*","Tree","parameter","*","]","List","of","Nominal","attributes",".","If","empty",",","then","assume","that","all","attributes","are","numerical",".","splitter","[","*","Tree","parameter","*","]","The","Splitter","or","Attribute","Observer","(","AO",")","used","to","monitor","the","class","statistics","of","numeric","features","and","perform","splits",".","Splitters","are","available","in","the","`","tree.splitter","`","module",".","Different","splitters","are","available","for","classification","and","regression","tasks",".","Classification","and","regression","splitters","can","be","distinguished","by","their","property","`","is_target_class","`",".","This","is","an","advanced","option",".","Special","care","must","be","taken","when","choosing","different","splitters",".","By","default",",","`","tree.splitter.GaussianSplitter","`","is","used","if","`","splitter","`","is","`","None","`",".","binary_split","[","*","Tree","parameter","*","]","If","True",",","only","allow","binary","splits",".","min_branch_fraction","[","*","Tree","parameter","*","]","The","minimum","percentage","of","observed","data","required","for","branches","resulting","from","split","candidates",".","To","validate","a","split","candidate",",","at","least","two","resulting","branches","must","have","a","percentage","of","samples","greater","than","`","min_branch_fraction","`",".","This","criterion","prevents","unnecessary","splits","when","the","majority","of","instances","are","concentrated","in","a","single","branch",".","max_share_to_split","[","*","Tree","parameter","*","]","Only","perform","a","split","in","a","leaf","if","the","proportion","of","elements","in","the","majority","class","is","smaller","than","this","parameter","value",".","This","parameter","avoids","performing","splits","when","most","of","the","data","belongs","to","a","single","class",".","max_size","[","*","Tree","parameter","*","]","Maximum","memory","(","MB",")","consumed","by","the","tree",".","memory_estimate_period","[","*","Tree","parameter","*","]","Number","of","instances","between","memory","consumption","checks",".","stop_mem_management","[","*","Tree","parameter","*","]","If","True",",","stop","growing","as","soon","as","memory","limit","is","hit",".","remove_poor_attrs","[","*","Tree","parameter","*","]","If","True",",","disable","poor","attributes","to","reduce","memory","usage",".","merit_preprune","[","*","Tree","parameter","*","]","If","True",",","enable","merit-based","tree","pre-pruning",".","seed","Random","seed","for","reproducibility",".","Examples","--","--","--","--",">",">",">","from","river","import","evaluate",">",">",">","from","river","import","forest",">",">",">","from","river","import","metrics",">",">",">","from","river.datasets","import","synth",">",">",">","dataset","=","synth.ConceptDriftStream","(","...","seed=42",",","...","position=500",",","...","width=40","...",")",".take","(","1000",")",">",">",">","model","=","forest.ARFClassifier","(","seed=8",",","leaf_prediction=","''","mc","''",")",">",">",">","metric","=","metrics.Accuracy","(",")",">",">",">","evaluate.progressive_val_score","(","dataset",",","model",",","metric",")","Accuracy",":","71.17","%","The","total","number","of","warnings","and","drifts","detected",",","respectively",">",">",">","model.n_warnings_detected","(",")",",","model.n_drifts_detected","(",")","(","2",",","1",")","The","number","of","warnings","detected","by","tree","number","2",">",">",">","model.n_warnings_detected","(","2",")","1","And","the","corresponding","number","of","actual","concept","drift","detected",">",">",">","model.n_drifts_detected","(","2",")","1","References","--","--","--","--","--","[","^1","]",":","Heitor","Murilo","Gomes",",","Albert","Bifet",",","Jesse","Read",",","Jean","Paul","Barddal",",","Fabricio","Enembreck",",","Bernhard","Pfharinger",",","Geoff","Holmes",",","Talel","Abdessalem",".","Adaptive","random","forests","for","evolving","data","stream","classification",".","In","Machine","Learning",",","DOI",":","10.1007\/s10994-017-5642-8",",","Springer",",","2017","."]
code: def _mutable_attributes(self):
      return {
          "max_features",
          "lambda_value",
          "grace_period",
          "delta",
          "tau",
      }
  
imports: from __future__ import annotations
  import abc
  import collections
  import copy
  import math
  import random
  import typing
  import numpy
  from river import base, metrics, stats
  from river.drift import ADWIN, NoDrift
  from river.tree.hoeffding_tree_classifier import HoeffdingTreeClassifier
  from river.tree.hoeffding_tree_regressor import HoeffdingTreeRegressor
  from river.tree.nodes.arf_htc_nodes import RandomLeafMajorityClass, RandomLeafNaiveBayes, RandomLeafNaiveBayesAdaptive
  from river.tree.nodes.arf_htr_nodes import RandomLeafAdaptive, RandomLeafMean, RandomLeafModel
  from river.tree.splitter import Splitter
  from river.utils.random import poisson
label_desc: Use image node_id 2 for calling the ARFClassifier obj's underlying member method code with example usage: obj._mutable_attributes() and returns: unknown