Noise

class rackio_AI.Noise()

Encapsulates method to work with noise

add(self, df, win_size=30, method='rhinehardt', cols=None, std_factor=0.001)

Add gaussian noise over subsequence windows based on some method

Parameters

  • :param df: (pandas.DataFrame)
  • :param win_size: (int) window size to apply gaussian noise
  • :param method: (str) method to base gaussian noise
    • rhinehardt or rh
  • :param cols: (list) column names to add gaussian noise.

returns

  • df (pandas.DataFrame) noise added

**Snippet code

>>> import matplotlib.pyplot as plt
>>> from rackio_AI import Noise
>>> df = pd.DataFrame(np.random.randn(100,2), columns=["a", "b"])
>>> noise = Noise()
>>> df_noisy = noise.add(df, win_size=10)
>>> ax = plt.plot(df.index, df["a"], '-r', df.index, df["b"], '-b', df_noisy.index, df_noisy["a"], '--r', df_noisy.index, df_noisy["b"], '--b')
>>> ax = plt.legend(["a", "b", "noisy a", "noisy b"])
>>> plt.show()

Add rhinehardt noise

rhinehardt(self, x, std_factor=1)

Add noise to variable x based on Box-Muller transform

Parameters

  • :param x: (pandas.DataFrame)