drift
DriftGenerator
Bases: GeneratorMixin
Base class for transformers that add noise to tabular data
Source code in badgers/generators/tabular_data/drift.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|
__init__(random_generator=default_rng(seed=0))
:param random_generator: numpy.random.Generator, default default_rng(seed=0) A random generator
Source code in badgers/generators/tabular_data/drift.py
18 19 20 21 22 23 |
|
RandomShiftClassesGenerator
Bases: DriftGenerator
Randomly shift (geometrical translation) values of each class independently of one another. Data are first standardized (mean = 0, var = 1) and for each class a random number is added to all instances.
Source code in badgers/generators/tabular_data/drift.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
|
__init__(random_generator=default_rng(seed=0))
:param random_generator: A random generator
Source code in badgers/generators/tabular_data/drift.py
78 79 80 81 82 |
|
generate(X, y, shift_std=0.1)
Randomly shift (geometrical translation) values of each class independently of one another. Data are first standardized (mean = 0, var = 1) and for each class a random number is added to all instances.
:param X: :param y: :param shift_std: The standard deviation of the amount of shift applied (shift is chosen from a normal distribution)
Source code in badgers/generators/tabular_data/drift.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
|
RandomShiftGenerator
Bases: DriftGenerator
Randomly shift (geometrical translation) values of each column independently of one another.
Data are first standardized (mean = 0, var = 1) and a random number is added to each column.
The ith columns is simply translated: $x_i \left arrow x_i + \epsilon_i$
Source code in badgers/generators/tabular_data/drift.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|
__init__(random_generator=default_rng(seed=0))
:param random_generator: A random generator :param shift_std: The standard deviation of the amount of shift applied (shift is chosen from a normal distribution)
Source code in badgers/generators/tabular_data/drift.py
38 39 40 41 42 43 44 |
|
generate(X, y=None, shift_std=0.1)
Randomly shift (geometrical translation) values of each column independently of one another.
Data are first standardized (mean = 0, var = 1) and a random number is added to each column.
The ith columns is simply translated: $x_i \left arrow x_i + \epsilon_i$
:param X: :param y: :param shift_std: :return:
Source code in badgers/generators/tabular_data/drift.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|