class_docstr: LED stream generator with concept drift.
  
  This class is an extension of the `LED` generator whose purpose is to add
  concept drift to the stream.
  
  Parameters
  ----------
  seed
      Random seed for reproducibility.
  noise_percentage
      The probability that noise will happen in the generation. At each
      new sample generated, a random number is generated, and if it is equal
      or less than the noise_percentage, the led value  will be switched
  irrelevant_features
      Adds 17 non-relevant attributes to the stream.
  n_drift_features
      The number of attributes that have drift.
  
  Examples
  --------
  >>> from river.datasets import synth
  
  >>> dataset = synth.LEDDrift(seed = 112, noise_percentage = 0.28,
  ...                          irrelevant_features= True, n_drift_features=4)
  
  >>> for x, y in dataset.take(5):
  ...     print(list(x.values()), y)
  [1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1] 7
  [1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0] 6
  [0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1] 1
  [1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1] 6
  [1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0] 7
  
  Notes
  -----
  An instance is generated based on the parameters passed. If `has_noise`
  is set then the total number of attributes will be 24, otherwise there will
  be 7 attributes.
class_docstr_tok: ["LED","stream","generator","with","concept","drift",".","This","class","is","an","extension","of","the","`","LED","`","generator","whose","purpose","is","to","add","concept","drift","to","the","stream",".","Parameters","--","--","--","--","--","seed","Random","seed","for","reproducibility",".","noise_percentage","The","probability","that","noise","will","happen","in","the","generation",".","At","each","new","sample","generated",",","a","random","number","is","generated",",","and","if","it","is","equal","or","less","than","the","noise_percentage",",","the","led","value","will","be","switched","irrelevant_features","Adds","17","non-relevant","attributes","to","the","stream",".","n_drift_features","The","number","of","attributes","that","have","drift",".","Examples","--","--","--","--",">",">",">","from","river.datasets","import","synth",">",">",">","dataset","=","synth.LEDDrift","(","seed","=","112",",","noise_percentage","=","0.28",",","...","irrelevant_features=","True",",","n_drift_features=4",")",">",">",">","for","x",",","y","in","dataset.take","(","5",")",":","...","print","(","list","(","x.values","(",")",")",",","y",")","[","1",",","0",",","0",",","1",",","1",",","1",",","0",",","1",",","1",",","1",",","1",",","0",",","0",",","0",",","1",",","1",",","1",",","0",",","1",",","0",",","0",",","0",",","0",",","1","]","7","[","1",",","1",",","0",",","0",",","1",",","0",",","0",",","1",",","0",",","1",",","1",",","0",",","1",",","1",",","0",",","0",",","1",",","1",",","0",",","0",",","1",",","1",",","0",",","0","]","6","[","0",",","0",",","0",",","1",",","1",",","0",",","1",",","0",",","1",",","0",",","0",",","0",",","1",",","1",",","1",",","1",",","1",",","0",",","1",",","1",",","0",",","0",",","0",",","1","]","1","[","1",",","0",",","0",",","1",",","1",",","1",",","1",",","0",",","0",",","1",",","1",",","1",",","0",",","1",",","1",",","0",",","1",",","1",",","1",",","1",",","0",",","1",",","0",",","1","]","6","[","1",",","0",",","1",",","1",",","1",",","0",",","1",",","0",",","1",",","1",",","1",",","0",",","0",",","0",",","1",",","0",",","0",",","0",",","0",",","0",",","0",",","1",",","1",",","0","]","7","Notes","--","--","-","An","instance","is","generated","based","on","the","parameters","passed",".","If","`","has_noise","`","is","set","then","the","total","number","of","attributes","will","be","24",",","otherwise","there","will","be","7","attributes","."]
code: def __iter__(self):
      self._rng = random.Random(self.seed)
      self._attr_idx = list(range(self._N_FEATURES_INCLUDING_NOISE))
  
      # Change attributes
      if self.irrelevant_features and self.n_drift_features > 0:
          random_int = self._rng.randint(0, 6)
          offset = self._rng.randint(
              0, self._N_IRRELEVANT_ATTRIBUTES - 1
          )
          for i in range(self.n_drift_features):
              value_1 = (i + random_int) % 7
              value_2 = 7 + (i + offset) % self._N_IRRELEVANT_ATTRIBUTES
              self._attr_idx[value_1] = value_2
              self._attr_idx[value_2] = value_1
  
      while True:
          x = {
              i: -1 for i in range(self.n_features)
          }  # Initialize to keep order in dictionary
          y = self._rng.randint(0, self.n_classes - 1)
  
          for i in range(self._N_RELEVANT_FEATURES):
              if (0.01 + self._rng.random()) <= self.noise_percentage:
                  x[self._attr_idx[i]] = int(
                      self._ORIGINAL_INSTANCES[y][i] == 0
                  )
              else:
                  x[self._attr_idx[i]] = self._ORIGINAL_INSTANCES[y][i]
          if self.irrelevant_features:
              for i in range(
                  self._N_RELEVANT_FEATURES,
                  self._N_FEATURES_INCLUDING_NOISE,
              ):
                  x[self._attr_idx[i]] = self._rng.choice([0, 1])
  
          yield x, y
  
file_path: river/river/datasets/synth/led.py
imports: from __future__ import annotations
  import random
  from river import datasets
label_desc: Use image node_id 2 for calling the LEDDrift obj's underlying member method code with example usage: obj.__iter__() without return types