I am trying to plot something similar to below:
I am using Matlab. I achieved drawing contour plots. However I could not draw the discriminant. Can anyone show a sample Matlab code or give some idea to draw the discriminant?
I am trying to plot something similar to below:
I am using Matlab. I achieved drawing contour plots. However I could not draw the discriminant. Can anyone show a sample Matlab code or give some idea to draw the discriminant?
Here is how I would solve this problem analytically: you equate these two discriminant functions
then, I consider W2 - W1 to have be this matrix
which then by expanding vector x=[x1 x2]', we get:
this is the equation of an ellipse, so you can simplify it into the form below:
Or, you can assume that you know the range of x1 for example x1=[-2:0.1:2], and then solve the parabola
If you know the probability density function of each of the gaussian for a given point
(x,y)
, lets say itspdf1(x,y)
andpdf2(x,y)
then you can simply plot the contour line off(x,y) := pdf1(x,y) > pdf2(x,y)
. So you define functionf
to be1
iffpdf1(x,y)>pdf2(x,y)
. This way the only contour will be placed along the curve wherepdf1(x,y)==pdf2(x,y)
which is the decision boundary (discriminant). If you wish to define "nice" function you can do it simply by settingf(x,y) = sgn( pdf1(x,y) - pdf2(x,y) )
, and plotting its contour plot will result in exact same discriminant.