Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from __future__ import print_function, division, absolute_import
- import matplotlib
- matplotlib.use('TkAgg')
- from matplotlib import pyplot as plt
- import numpy as np
- x = np.linspace(0, 100, num=50)
- # Idea: the trending is x, but at each step, it is affected
- # by unknown latent factor that create this Gaussian noise
- magnitude = 8
- noise = np.random.randn(50) * magnitude # standard Gaussian noise, magnifie to see clear effect
- y = x[::-1] + noise # we want to so an decreasing trend so reverse x
- print(x, y)
- plt.plot(x, y)
- plt.plot(x, x[::-1], color='r') # the actual trend with the effect of noise
- plt.show(block=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement