Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. dlist = [1, 2, 5, 10, 20, 50, 100, 200, 500, 1000]
  2.  
  3. pytlist = []
  4. nptlist = []
  5. for d in dlist:
  6.     U, X, Y = data.toy(100, 100, d)
  7.    
  8.     X = X.tolist()
  9.    
  10.     pya = time.process_time()
  11.     pybatch(U, X, Y)
  12.     pyb = time.process_time()
  13.    
  14.     pytlist += [pyb - pya]
  15.    
  16.     npa = time.process_time()
  17.     pybatch(U, X, Y, nearest=npnearest)
  18.     npb = time.process_time()
  19.    
  20.     nptlist += [npb - npa]
  21.  
  22. plt.figure(figsize=(5, 3))
  23. plt.plot(dlist, pytlist, '-s', color='red')
  24. plt.plot(dlist, nptlist, '-o', color='blue')
  25.  
  26. plt.xscale('log'); plt.yscale('log'); plt.xlabel('d'); plt.ylabel('time'); plt.grid(True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement