In [1]:
%matplotlib inline
from matplotlib import pylab
import numpy as np
In [2]:
X1 = np.linspace(0,2,10)
X2 = X1*np.random.rand(10)
X3 = np.linspace(4,6,10)
X4 = X3*np.random.rand(10)
a = np.ones(10)*3
In [3]:
pylab.scatter(X1,X2, color="b", marker="o", label="Neg")
pylab.scatter(X3,X4, color="r", marker="x", label="Pos")
pylab.plot(a,np.arange(-1,9),label="Decision Boundary")
pylab.xlabel("feature X1")
pylab.ylabel("feature X2")
pylab.legend(loc="upper right", bbox_to_anchor=(1.5,1))
pylab.show()
In [4]:
z = np.linspace(-5,5)
In [5]:
def sigmoid(x):
return 1./(1. + np.exp(-x))
In [6]:
pylab.plot(z,sigmoid(z),label="Sigmoid Curve")
pylab.xlabel("Distance of point from Decision Boundary")
pylab.ylabel("P(X)")
pylab.legend(loc="best")
pylab.show()