问题描述
我正在尝试绘制类似于以下内容的内容:
I am trying to plot something similar to below:
我正在使用Matlab.我实现了绘制等高线图.但是我无法区分.谁能展示示例Matlab代码或给出一些想法来区分?
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?
推荐答案
如果您知道给定点(x,y)
的每个高斯的概率密度函数,可以说其pdf1(x,y)
和pdf2(x,y)
,那么您可以只需绘制f(x,y) := pdf1(x,y) > pdf2(x,y)
的轮廓线即可.因此,将功能f
定义为1
且pdf1(x,y)>pdf2(x,y)
.这样,唯一的轮廓将沿着曲线放置,其中pdf1(x,y)==pdf2(x,y)
是决策边界(区分).如果您想定义"nice"功能,则只需设置f(x,y) = sgn( pdf1(x,y) - pdf2(x,y) )
即可完成,并绘制其轮廓图将导致完全相同的判别.
If you know the probability density function of each of the gaussian for a given point (x,y)
, lets say its pdf1(x,y)
and pdf2(x,y)
then you can simply plot the contour line of f(x,y) := pdf1(x,y) > pdf2(x,y)
. So you define function f
to be 1
iff pdf1(x,y)>pdf2(x,y)
. This way the only contour will be placed along the curve where pdf1(x,y)==pdf2(x,y)
which is the decision boundary (discriminant). If you wish to define "nice" function you can do it simply by setting f(x,y) = sgn( pdf1(x,y) - pdf2(x,y) )
, and plotting its contour plot will result in exact same discriminant.
这篇关于两个多元高斯的绘图决策边界的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!