class_docstr: Baseline drift detector that generates pseudo drift detection signals.
  
  There are two approaches[^1]:
  
  - `fixed` where the drift signal is generated every `t_0` samples.
  - `random` corresponds to a pseudo-random drift detection strategy.
  
  Parameters
  ----------
  trigger_method
      The trigger method to use.<br/>
      * `fixed`<br/>
      * `random`
  t_0
      Reference point to define triggers.
  w
      Auxiliary parameter whose purpose is twofold:</br>
      - if `trigger_method="fixed"`, the periodic drift signals will only start after an initial
      warm-up period randomly defined between `[0, w]`. Useful to avoid that all ensemble
      members are reset at the same time when periodic triggers are used as the adaptation strategy.</br>
      - if `trigger_method="random"`, `w` defines the probability bounds of triggering a drift. The
      chance of triggering a drift is $0.5$ after observing `t_0` instances and becomes $1$ after
      monitoring `t_0 + w / 2` instances. A sigmoid function is used to produce values between `[0, 1]`
      that are used as the reset probabilities.
  dynamic_cloning
      Whether to change the `seed` and `w` values each time `clone()` is called.
  seed
      Random seed for reproducibility.
  
  Examples
  --------
  >>> import random
  >>> from river import drift
  
  >>> rng = random.Random(42)
  
  The observed values will not affect the periodic triggers.
  
  >>> data = [rng.gauss(0, 1) for _ in range(1000)]
  
  Let's start with the fixed drift signals:
  
  >>> ptrigger = DummyDriftDetector(t_0=500, seed=42)
  >>> for i, v in enumerate(data):
  ...     ptrigger.update(v)
  ...     if ptrigger.drift_detected:
  ...         print(f"Drift detected at instance {i}.")
  Drift detected at instance 499.
  Drift detected at instance 999.
  
  Now, the random drift signals:
  
  >>> rtrigger = DummyDriftDetector(
  ...     trigger_method="random",
  ...     t_0=500,
  ...     w=100,
  ...     dynamic_cloning=True,
  ...     seed=42
  ... )
  >>> for i, v in enumerate(data):
  ...     rtrigger.update(v)
  ...     if rtrigger.drift_detected:
  ...         print(f"Drift detected at instance {i}.")
  Drift detected at instance 368.
  Drift detected at instance 817.
  
  Remember to set a w > 0 value if random triggers are used:
  
  >>> try:
  ...     DummyDriftDetector(trigger_method="random")
  ... except ValueError as ve:
  ...     print(ve)
  The 'w' value must be greater than zero when 'trigger_method' is 'random'.
  
  Since we set `dynamic_cloning` to `True`, a clone of the periodic trigger will
  have its internal paramenters changed:
  
  >>> rtrigger = rtrigger.clone()
  >>> for i, v in enumerate(data):
  ...     rtrigger.update(v)
  ...     if rtrigger.drift_detected:
  ...         print(f"Drift detected at instance {i}.")
  Drift detected at instance 429.
  Drift detected at instance 728.
  
  Notes
  -----
  When used in ensembles, a naive implementation of periodic drift signals would make all ensemble members
  reset at the same time. To avoid that, the `dynamic_cloning` parameter can be set to `True`. In this case,
  every time the `clone` method of this detector is called in an ensemble a new `seed` is defined. If
  `dynamic_cloning=True` and `trigger_method="fixed"`, a new `w` between `[0, t_0]` will also be created
  for the new cloned instance.
  
  References
  ----------
  [^1]: Heitor Gomes, Jacob Montiel, Saulo Martiello Mastelini, Bernhard Pfahringer, and Albert Bifet.
  On Ensemble Techniques for Data Stream Regression. IJCNN'20. International Joint Conference on
  Neural Networks. 2020.
class_docstr_tok: ["Baseline","drift","detector","that","generates","pseudo","drift","detection","signals",".","There","are","two","approaches","[","^1","]",":","-","`","fixed","`","where","the","drift","signal","is","generated","every","`","t_0","`","samples",".","-","`","random","`","corresponds","to","a","pseudo-random","drift","detection","strategy",".","Parameters","--","--","--","--","--","trigger_method","The","trigger","method","to","use.","<","br\/",">","*","`","fixed","`","<","br\/",">","*","`","random","`","t_0","Reference","point","to","define","triggers",".","w","Auxiliary","parameter","whose","purpose","is","twofold",":","<","\/br",">","-","if","`","trigger_method=","''","fixed","''","`",",","the","periodic","drift","signals","will","only","start","after","an","initial","warm-up","period","randomly","defined","between","`","[","0",",","w","]","`",".","Useful","to","avoid","that","all","ensemble","members","are","reset","at","the","same","time","when","periodic","triggers","are","used","as","the","adaptation","strategy.","<","\/br",">","-","if","`","trigger_method=","''","random","''","`",",","`","w","`","defines","the","probability","bounds","of","triggering","a","drift",".","The","chance","of","triggering","a","drift","is","$","0.5","$","after","observing","`","t_0","`","instances","and","becomes","$","1","$","after","monitoring","`","t_0","+","w","\/","2","`","instances",".","A","sigmoid","function","is","used","to","produce","values","between","`","[","0",",","1","]","`","that","are","used","as","the","reset","probabilities",".","dynamic_cloning","Whether","to","change","the","`","seed","`","and","`","w","`","values","each","time","`","clone","(",")","`","is","called",".","seed","Random","seed","for","reproducibility",".","Examples","--","--","--","--",">",">",">","import","random",">",">",">","from","river","import","drift",">",">",">","rng","=","random.Random","(","42",")","The","observed","values","will","not","affect","the","periodic","triggers",".",">",">",">","data","=","[","rng.gauss","(","0",",","1",")","for","_","in","range","(","1000",")","]","Let","'s","start","with","the","fixed","drift","signals",":",">",">",">","ptrigger","=","DummyDriftDetector","(","t_0=500",",","seed=42",")",">",">",">","for","i",",","v","in","enumerate","(","data",")",":","...","ptrigger.update","(","v",")","...","if","ptrigger.drift_detected",":","...","print","(","f","''","Drift","detected","at","instance","{","i","}",".","''",")","Drift","detected","at","instance","499",".","Drift","detected","at","instance","999",".","Now",",","the","random","drift","signals",":",">",">",">","rtrigger","=","DummyDriftDetector","(","...","trigger_method=","''","random","''",",","...","t_0=500",",","...","w=100",",","...","dynamic_cloning=True",",","...","seed=42","...",")",">",">",">","for","i",",","v","in","enumerate","(","data",")",":","...","rtrigger.update","(","v",")","...","if","rtrigger.drift_detected",":","...","print","(","f","''","Drift","detected","at","instance","{","i","}",".","''",")","Drift","detected","at","instance","368",".","Drift","detected","at","instance","817",".","Remember","to","set","a","w",">","0","value","if","random","triggers","are","used",":",">",">",">","try",":","...","DummyDriftDetector","(","trigger_method=","''","random","''",")","...","except","ValueError","as","ve",":","...","print","(","ve",")","The","'","w","'","value","must","be","greater","than","zero","when","'trigger_method","'","is","'random","'",".","Since","we","set","`","dynamic_cloning","`","to","`","True","`",",","a","clone","of","the","periodic","trigger","will","have","its","internal","paramenters","changed",":",">",">",">","rtrigger","=","rtrigger.clone","(",")",">",">",">","for","i",",","v","in","enumerate","(","data",")",":","...","rtrigger.update","(","v",")","...","if","rtrigger.drift_detected",":","...","print","(","f","''","Drift","detected","at","instance","{","i","}",".","''",")","Drift","detected","at","instance","429",".","Drift","detected","at","instance","728",".","Notes","--","--","-","When","used","in","ensembles",",","a","naive","implementation","of","periodic","drift","signals","would","make","all","ensemble","members","reset","at","the","same","time",".","To","avoid","that",",","the","`","dynamic_cloning","`","parameter","can","be","set","to","`","True","`",".","In","this","case",",","every","time","the","`","clone","`","method","of","this","detector","is","called","in","an","ensemble","a","new","`","seed","`","is","defined",".","If","`","dynamic_cloning=True","`","and","`","trigger_method=","''","fixed","''","`",",","a","new","`","w","`","between","`","[","0",",","t_0","]","`","will","also","be","created","for","the","new","cloned","instance",".","References","--","--","--","--","--","[","^1","]",":","Heitor","Gomes",",","Jacob","Montiel",",","Saulo","Martiello","Mastelini",",","Bernhard","Pfahringer",",","and","Albert","Bifet",".","On","Ensemble","Techniques","for","Data","Stream","Regression",".","IJCNN'20",".","International","Joint","Conference","on","Neural","Networks",".","2020","."]
code: def _fixed_trigger(self):
      if not self._warmup_done:
          if self._n >= self._warmup:
              self._n = 0
              self._warmup_done = True
      elif self._n >= self.t_0:
          self._drift_detected = True
          self._n = 0
  
file_path: river/river/drift/dummy.py
imports: from __future__ import annotations
  import math
  import random
  from river import base
label_desc: Use image node_id 2 for calling the DummyDriftDetector obj's underlying member method code with example usage: obj._fixed_trigger() without return types