Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. from __future__ import print_function, division, absolute_import
  2.  
  3. import matplotlib
  4. matplotlib.use('TkAgg')
  5. from matplotlib import pyplot as plt
  6.  
  7. import numpy as np
  8.  
  9. x = np.linspace(0, 100, num=50)
  10. # Idea: the trending is x, but at each step, it is affected
  11. # by unknown latent factor that create this Gaussian noise
  12. magnitude = 8
  13. noise = np.random.randn(50) * magnitude # standard Gaussian noise, magnifie to see clear effect
  14.  
  15. y = x[::-1] + noise # we want to so an decreasing trend so reverse x
  16. print(x, y)
  17.  
  18. plt.plot(x, y)
  19. plt.plot(x, x[::-1], color='r') # the actual trend with the effect of noise
  20. plt.show(block=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement