Guest User

Untitled

a guest
Jul 22nd, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. from matplotlib.colors import ListedColormap
  2. xset,yset = xtrain,ytrain
  3. x1,x2 = np.meshgrid(np.arange(start = xset[:,0].min()-1,stop = xset[:,0].max()+1,step = .01),np.arange(start = xset[:,1].min()-1,stop = xset[:,1].max()+1,step = .01))
  4. plt.contourf(x1,x2,classifier.predict(np.array([x1.ravel(),x2.ravel()]).T).reshape(x1.shape),alpha=.75,cmap = ListedColormap(('red','green')))
  5. for i,j in enumerate(np.unique(yset)):
  6. plt.scatter(xset[yset==j,0],xset[yset==j,1],cmap=ListedColormap(('red','green'))(i),label = j,marker='+')
Add Comment
Please, Sign In to add comment