As we claimed before, we will use two mono-dimensional signals as timeseries for our experiment. The first is a cosine wave with some added uniform noise.
This is the function to generate the cosine signal, given (as parameters) the number of points, the frequency of the signal, and the absolute intensity of the uniform generator for the noise. Also, in the body of the function, we're making sure to set the random seed, so we can make our experiments replicable:
def fetch_cosine_values(seq_len, frequency=0.01, noise=0.1):
np.random.seed(101)
x = np.arange(0.0, seq_len, 1.0)
return np.cos(2 * np.pi * frequency * x) + np.random.uniform(low=-noise, high=noise, size=seq_len)
To print 10 points, one full oscillation of the cosine (therefore frequency is 0.1) with 0.1 magnitude noise, run:
print(fetch_cosine_values(10, frequency...