Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. def plot_sn2(X,Y,sn,ax,i,rwb):
  2.  
  3. X1=np.linspace(-10,10,100)
  4. X2=np.linspace(-10,10,100)
  5. XX1,XX2=np.meshgrid(X1,X2)
  6. YY=np.zeros(XX1.shape)
  7. for i in range(X2.size):
  8. for j in range(X1.size):
  9. YY[i,j]=sn.sigmoid(sn.perceptronIN(np.asarray([X1[j],X2[i]]),list(rwb[i][0][0]),rwb[i][1][0]))
  10. ax.contourf(XX1,XX2,YY,cmap=my_cmap,alpha=0.6)
  11. ax.scatter(X[:,0],X[:,1],c=Y,cmap=my_cmap)
  12. ax.plot()
  13.  
  14. fig,ax = plt.subplots()
  15. rwb=sn.rwb()
  16. def animate(i):
  17. ax.clear()
  18. if(i==0):
  19. i+=1
  20. plot_sn2(X,Y,sn,ax,i,rwb)
  21.  
  22.  
  23. interval = 2#in seconds
  24. anim = animation.FuncAnimation(fig, animate, frames=1000, interval=200, blit=True)
  25. HTML(anim.to_html5_video())
  26. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement