Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from matplotlib.colors import ListedColormap
- xset,yset = xtrain,ytrain
- 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))
- plt.contourf(x1,x2,classifier.predict(np.array([x1.ravel(),x2.ravel()]).T).reshape(x1.shape),alpha=.75,cmap = ListedColormap(('red','green')))
- for i,j in enumerate(np.unique(yset)):
- plt.scatter(xset[yset==j,0],xset[yset==j,1],cmap=ListedColormap(('red','green'))(i),label = j,marker='+')
- plt.xlabel('Age')
- plt.ylabel('Estimated Salary')
- plt.show()
Add Comment
Please, Sign In to add comment