class_docstr: Extremely Fast Decision Tree (EFDT) classifier.
  
  Also referred to as the Hoeffding AnyTime Tree (HATT) classifier. In practice,
  despite the name, EFDTs are typically slower than a vanilla Hoeffding Tree
  to process data. The speed differences come from the mechanism of split
  re-evaluation present in EFDT. Nonetheless, EFDT has theoretical properties
  that ensure it converges faster than the vanilla Hoeffding Tree to the structure
  that would be created by a batch decision tree model (such as Classification and
  Regression Trees - CART). Keep in mind that such propositions hold when processing
  a stationary data stream. When dealing with non-stationary data, EFDT is somewhat
  robust to concept drifts as it continually revisits and updates its internal
  decision tree structure. Still, in such cases, the Hoeffind Adaptive Tree might
  be a better option, as it was specifically designed to handle non-stationarity.
  
  
  Parameters
  ----------
  grace_period
      Number of instances a leaf should observe between split attempts.
  max_depth
      The maximum depth a tree can reach. If `None`, the tree will grow indefinitely.
  min_samples_reevaluate
      Number of instances a node should observe before reevaluating the best split.
  split_criterion
      Split criterion to use.</br>
      - 'gini' - Gini</br>
      - 'info_gain' - Information Gain</br>
      - 'hellinger' - Helinger Distance</br>
  delta
      Significance level to calculate the Hoeffding bound. The significance level is given by
      `1 - delta`. Values closer to zero imply longer split decision delays.
  tau
      Threshold below which a split will be forced to break ties.
  leaf_prediction
      Prediction mechanism used at leafs.</br>
      - 'mc' - Majority Class</br>
      - 'nb' - Naive Bayes</br>
      - 'nba' - Naive Bayes Adaptive</br>
  nb_threshold
      Number of instances a leaf should observe before allowing Naive Bayes.
  nominal_attributes
      List of Nominal attributes identifiers. If empty, then assume that all numeric attributes
      should be treated as continuous.
  splitter
      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
      If True, only allow binary splits.
  min_branch_fraction
      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
      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
      The max size of the tree, in Megabytes (MB).
  memory_estimate_period
      Interval (number of processed instances) between memory consumption checks.
  stop_mem_management
      If True, stop growing as soon as memory limit is hit.
  remove_poor_attrs
      If True, disable poor attributes to reduce memory usage.
  merit_preprune
      If True, enable merit-based tree pre-pruning.
  
  Notes
  -----
  The Extremely Fast Decision Tree (EFDT) [^1] constructs a tree incrementally. The EFDT seeks to
  select and deploy a split as soon as it is confident the split is useful, and then revisits
  that decision, replacing the split if it subsequently becomes evident that a better split is
  available. The EFDT learns rapidly from a stationary distribution and eventually it learns the
  asymptotic batch tree if the distribution from which the data are drawn is stationary.
  
  References
  ----------
  [^1]:  C. Manapragada, G. Webb, and M. Salehi. Extremely Fast Decision Tree.
  In Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery & Data
  Mining (KDD '18). ACM, New York, NY, USA, 1953-1962.
  DOI: https://doi.org/10.1145/3219819.3220005
  
  Examples
  --------
  >>> from river.datasets import synth
  >>> from river import evaluate
  >>> from river import metrics
  >>> from river import tree
  
  >>> gen = synth.Agrawal(classification_function=0, seed=42)
  >>> # Take 1000 instances from the infinite data generator
  >>> dataset = iter(gen.take(1000))
  
  >>> model = tree.ExtremelyFastDecisionTreeClassifier(
  ...     grace_period=100,
  ...     delta=1e-5,
  ...     nominal_attributes=['elevel', 'car', 'zipcode'],
  ...     min_samples_reevaluate=100
  ... )
  
  >>> metric = metrics.Accuracy()
  
  >>> evaluate.progressive_val_score(dataset, model, metric)
  Accuracy: 87.29%
class_docstr_tok: ["Extremely","Fast","Decision","Tree","(","EFDT",")","classifier",".","Also","referred","to","as","the","Hoeffding","AnyTime","Tree","(","HATT",")","classifier",".","In","practice",",","despite","the","name",",","EFDTs","are","typically","slower","than","a","vanilla","Hoeffding","Tree","to","process","data",".","The","speed","differences","come","from","the","mechanism","of","split","re-evaluation","present","in","EFDT",".","Nonetheless",",","EFDT","has","theoretical","properties","that","ensure","it","converges","faster","than","the","vanilla","Hoeffding","Tree","to","the","structure","that","would","be","created","by","a","batch","decision","tree","model","(","such","as","Classification","and","Regression","Trees","-","CART",")",".","Keep","in","mind","that","such","propositions","hold","when","processing","a","stationary","data","stream",".","When","dealing","with","non-stationary","data",",","EFDT","is","somewhat","robust","to","concept","drifts","as","it","continually","revisits","and","updates","its","internal","decision","tree","structure",".","Still",",","in","such","cases",",","the","Hoeffind","Adaptive","Tree","might","be","a","better","option",",","as","it","was","specifically","designed","to","handle","non-stationarity",".","Parameters","--","--","--","--","--","grace_period","Number","of","instances","a","leaf","should","observe","between","split","attempts",".","max_depth","The","maximum","depth","a","tree","can","reach",".","If","`","None","`",",","the","tree","will","grow","indefinitely",".","min_samples_reevaluate","Number","of","instances","a","node","should","observe","before","reevaluating","the","best","split",".","split_criterion","Split","criterion","to","use.","<","\/br",">","-","'gini","'","-","Gini","<","\/br",">","-","'info_gain","'","-","Information","Gain","<","\/br",">","-","'hellinger","'","-","Helinger","Distance","<","\/br",">","delta","Significance","level","to","calculate","the","Hoeffding","bound",".","The","significance","level","is","given","by","`","1","-","delta","`",".","Values","closer","to","zero","imply","longer","split","decision","delays",".","tau","Threshold","below","which","a","split","will","be","forced","to","break","ties",".","leaf_prediction","Prediction","mechanism","used","at","leafs.","<","\/br",">","-","'mc","'","-","Majority","Class","<","\/br",">","-","'nb","'","-","Naive","Bayes","<","\/br",">","-","'nba","'","-","Naive","Bayes","Adaptive","<","\/br",">","nb_threshold","Number","of","instances","a","leaf","should","observe","before","allowing","Naive","Bayes",".","nominal_attributes","List","of","Nominal","attributes","identifiers",".","If","empty",",","then","assume","that","all","numeric","attributes","should","be","treated","as","continuous",".","splitter","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","If","True",",","only","allow","binary","splits",".","min_branch_fraction","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","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","The","max","size","of","the","tree",",","in","Megabytes","(","MB",")",".","memory_estimate_period","Interval","(","number","of","processed","instances",")","between","memory","consumption","checks",".","stop_mem_management","If","True",",","stop","growing","as","soon","as","memory","limit","is","hit",".","remove_poor_attrs","If","True",",","disable","poor","attributes","to","reduce","memory","usage",".","merit_preprune","If","True",",","enable","merit-based","tree","pre-pruning",".","Notes","--","--","-","The","Extremely","Fast","Decision","Tree","(","EFDT",")","[","^1","]","constructs","a","tree","incrementally",".","The","EFDT","seeks","to","select","and","deploy","a","split","as","soon","as","it","is","confident","the","split","is","useful",",","and","then","revisits","that","decision",",","replacing","the","split","if","it","subsequently","becomes","evident","that","a","better","split","is","available",".","The","EFDT","learns","rapidly","from","a","stationary","distribution","and","eventually","it","learns","the","asymptotic","batch","tree","if","the","distribution","from","which","the","data","are","drawn","is","stationary",".","References","--","--","--","--","--","[","^1","]",":","C.","Manapragada",",","G.","Webb",",","and","M.","Salehi",".","Extremely","Fast","Decision","Tree",".","In","Proceedings","of","the","24th","ACM","SIGKDD","International","Conference","on","Knowledge","Discovery","&","Data","Mining","(","KDD","'18",")",".","ACM",",","New","York",",","NY",",","USA",",","1953-1962",".","DOI",":","https",":","\/\/doi.org\/10.1145\/3219819.3220005","Examples","--","--","--","--",">",">",">","from","river.datasets","import","synth",">",">",">","from","river","import","evaluate",">",">",">","from","river","import","metrics",">",">",">","from","river","import","tree",">",">",">","gen","=","synth.Agrawal","(","classification_function=0",",","seed=42",")",">",">",">","#","Take","1000","instances","from","the","infinite","data","generator",">",">",">","dataset","=","iter","(","gen.take","(","1000",")",")",">",">",">","model","=","tree.ExtremelyFastDecisionTreeClassifier","(","...","grace_period=100",",","...","delta=1e-5",",","...","nominal_attributes=","[","'elevel","'",",","'car","'",",","'zipcode","'","]",",","...","min_samples_reevaluate=100","...",")",">",">",">","metric","=","metrics.Accuracy","(",")",">",">",">","evaluate.progressive_val_score","(","dataset",",","model",",","metric",")","Accuracy",":","87.29","%"]
docstr: Incrementally train the model
  
  Parameters
  ----------
  x
      Instance attributes.
  y
      The label of the instance.
  w
      The weight of the sample.
  
  Notes
  -----
  Training tasks:
  
  * If the tree is empty, create a leaf node as the root.
  * If the tree is already initialized, find the path from root to the corresponding leaf for
  the instance and sort the instance.
  * Reevaluate the best split for each internal node.
  * Attempt to split the leaf.
docstr_tok: ["Incrementally","train","the","model","Parameters","--","--","--","--","--","x","Instance","attributes",".","y","The","label","of","the","instance",".","w","The","weight","of","the","sample",".","Notes","--","--","-","Training","tasks",":","*","If","the","tree","is","empty",",","create","a","leaf","node","as","the","root",".","*","If","the","tree","is","already","initialized",",","find","the","path","from","root","to","the","corresponding","leaf","for","the","instance","and","sort","the","instance",".","*","Reevaluate","the","best","split","for","each","internal","node",".","*","Attempt","to","split","the","leaf","."]
code: def learn_one(self, x, y, *, w=1.0):
      """Incrementally train the model
  
      Parameters
      ----------
      x
          Instance attributes.
      y
          The label of the instance.
      w
          The weight of the sample.
  
      Notes
      -----
      Training tasks:
  
      * If the tree is empty, create a leaf node as the root.
      * If the tree is already initialized, find the path from root to the corresponding leaf for
      the instance and sort the instance.
      * Reevaluate the best split for each internal node.
      * Attempt to split the leaf.
  
      """
      # Updates the set of observed classes
      self.classes.add(y)
  
      self._train_weight_seen_by_model += w
  
      if self._root is None:
          self._root = self._new_leaf()
          self._n_active_leaves = 1
  
      # Sort instance X into a leaf
      self._sort_to_leaf(x, y, w)
      # Process all nodes, starting from root to the leaf where the instance x belongs.
      self._process_nodes(x, y, w, self._root, None, None)
  
file_path: river/river/tree/extremely_fast_decision_tree.py
imports: from __future__ import annotations
  from .hoeffding_tree_classifier import HoeffdingTreeClassifier
  from .nodes.branch import DTBranch
  from .nodes.efdtc_nodes import BaseEFDTBranch, EFDTLeafMajorityClass, EFDTLeafNaiveBayes, EFDTLeafNaiveBayesAdaptive, EFDTNominalBinaryBranch, EFDTNominalMultiwayBranch, EFDTNumericBinaryBranch, EFDTNumericMultiwayBranch
  from .nodes.leaf import HTLeaf
  from .splitter import Splitter
  from .utils import BranchFactory
label_desc: Use image node_id 5 for calling the ExtremelyFastDecisionTreeClassifier obj's underlying member method code with example usage: obj.learn_one(x, y) without return types