noise
GaussianNoiseClassesGenerator
Bases: NoiseGenerator
A generator that adds Gaussian white noise to each class separately.
Source code in badgers/generators/tabular_data/noise.py
65 66 67 68 69 70 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 108 109 110 111 |
|
__init__(random_generator=default_rng(seed=0))
:param random_generator: A random generator
Source code in badgers/generators/tabular_data/noise.py
70 71 72 73 74 75 |
|
generate(X, y, noise_std_per_class=dict())
Add Gaussian white noise to the data.
the data is first standardized (each column has a mean = 0 and variance = 1).
The noise is generated from a normal distribution with standard deviation = noise_std
.
The noise is added to the data.
:param X: the input :param y: the target :param noise_std_per_class: A dictionary giving the standard deviation of the noise to be added for each class key = class labels, values = noise std for this given class :return: Xt, yt
Source code in badgers/generators/tabular_data/noise.py
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 108 109 110 111 |
|
GaussianNoiseGenerator
Bases: NoiseGenerator
A generator that adds Gaussian white noise to the tabular data
Source code in badgers/generators/tabular_data/noise.py
28 29 30 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 |
|
__init__(random_generator=default_rng(seed=0))
:param random_generator: A random generator
Source code in badgers/generators/tabular_data/noise.py
33 34 35 36 37 38 39 |
|
generate(X, y, noise_std)
Adds Gaussian white noise to the data.
The data is first standardized (each column has a mean = 0 and variance = 1).
The noise is generated from a normal distribution with standard deviation = noise_std
.
The noise is added to the data.
:param X: the input :param y: the target :param noise_std: The standard deviation of the noise to be added :return: Xt, yt
Source code in badgers/generators/tabular_data/noise.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
|
NoiseGenerator
Bases: GeneratorMixin
Base class for generators that add noise to tabular data
Source code in badgers/generators/tabular_data/noise.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
|
__init__(random_generator=default_rng(seed=0))
:param random_generator: A random generator
Source code in badgers/generators/tabular_data/noise.py
17 18 19 20 21 |
|