I am doing a nonlinear two-class classification and the data has three dimension x=data[:,0] y= data[:,1], z=data[:,2].
I want to draw a decision boundary on the xy plane and also the scattering data simultaneously, to see if it fit well to the data. The result function I got is a sinusoidal function with y being input and x being output like this:
x= 2.2*sin(0.44 - 0.69*y) - 0.61
I an new to python and have trouble plotting this. Now I have wrote something like this:
x,y,c = np.loadtxt('bricks.csv',delimiter=',', unpack=True)
plt.scatter(x,y,c=c)
plt.show()
def decision_boundary(x_2):
x_1= float(2.2)*np.sin(0.44 - 0.69*x_2) - 0.61
return x_1
x2 = np.arange(-5.0, 5.0, 0.1)
plt.plot(decision_boundary(x2),x2)
,which give a wrong figure.Could someone help me out? Thanks!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.