Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def plot_sn2(X,Y,sn,ax,i,rwb):
- X1=np.linspace(-10,10,100)
- X2=np.linspace(-10,10,100)
- XX1,XX2=np.meshgrid(X1,X2)
- YY=np.zeros(XX1.shape)
- for i in range(X2.size):
- for j in range(X1.size):
- YY[i,j]=sn.sigmoid(sn.perceptronIN(np.asarray([X1[j],X2[i]]),list(rwb[i][0][0]),rwb[i][1][0]))
- ax.contourf(XX1,XX2,YY,cmap=my_cmap,alpha=0.6)
- ax.scatter(X[:,0],X[:,1],c=Y,cmap=my_cmap)
- ax.plot()
- fig,ax = plt.subplots()
-
- rwb=sn.rwb()
- def animate(i):
- ax.clear()
- if(i==0):
- i+=1
- plot_sn2(X,Y,sn,ax,i,rwb)
- interval = 2#in seconds
- anim = animation.FuncAnimation(fig, animate, frames=1000, interval=200, blit=True)
- HTML(anim.to_html5_video())
-
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement