多维高斯分布讲解_第1页
多维高斯分布讲解_第2页
多维高斯分布讲解_第3页
多维高斯分布讲解_第4页
多维高斯分布讲解_第5页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、多维高斯分布讲解 高斯分布 高 斯fl. CT2)A; (x S)一舟(X “)T£_i(x_p)对于1维的来说是期望,一一是方差;对于多维来说D表示X的维数,'-表示D*D的协方差矩阵,定义为划一;芯哄 总:+A (/«.5). al X = 0,2. 13t为该协方差的行列式的值。Example 1.3.1, Compute the value of a Gaussian pdf. 2,2, l,3r? where册=U s代码如下:m=0 1' S=eye(2);x1=0.2 1.3' x2=2.2 -1.3'pg仁comp_gauss

2、_de ns_val(m,S,x1) pg2=comp_gauss_de ns_val(m,S,x2) 其中comp_gauss_dens_val函数文件的代码如下: function z=comp_gauss_de ns_val(m,S,x) l,c=size(m);z=(1/( (2*pi)A(l/2)*det(S)A0.5) )*exp(-0.5*(x-m)'* in v(S)*(x-m);Example 1.3.2. (Consider t 2-class classitlcation task in lhe 2-tlimcnsional spacc< where I b

3、oth classes. a), an, are distributed according to the Gaussian di str i but i o ns A . 5 ) and j respectively. Let也=丨11|二加2 = 03= S =勿=AssumiJig that P(o) = 1/2. classifx x = 1.8, 1.8| jjiIo <i> or itn.题目大致意思就是判断x是属于w1还是w2 ?代码如下:P仁 0.5;P2=0.5;m1=1 1'm2=3 3'S=eye(2);x=1.8 1.8'p1=pi*

4、comp_gauss_de ns_val(m1,S,x)p2=P2*comp_gauss_de ns_val(m2,S,x)Example 1.3.3. Generate N = 500 2-dimciisional data points that are distributed accorcGaussian distribution Awith mean /? = |0, 0|z and covariance matrix S °02 o following cases:erf = £ = |7 cr2 = 0= 5 = 02 a2 0erf = erf 二 2, tr

5、i2 = 021 21 21 acrcr252.o一一25a-2 2CF2一一5«o一一2a4-=a=oy = 0.3,巧2» crj2 0,5erf = 03. a 2t <7j2 *0.5Plot each data set and comment on the shape of the cluslers formed by the da题目大致意思就是给出正态分布的期望和方差构造出一些服从这个分布的数据点代码如下:% Generate the first dataset (case #1) randn('seed',0);m=0 0' S

6、=1 0;0 1;N=500;X = mvnrnd(m,S,N)'% Plot the first dataset figure(1), plot(X(1,:),X(2,:),'.');figure(1), axis equal figure(1), axis(-7 7 -7 7)% Generate and plot the second dataset (case #2) m=0 0'S=0.2 0;0 0.2;N=500;X = mvnrnd(m,S,N)' figure(2), plot(X(1,:),X(2,:),'.'); f

7、igure(2), axis equal figure(2), axis(-7 7 -7 7)% Generate and plot the third dataset (case #3) m=0 0'S=2 0;0 2;N=500;X = mvnrnd(m,S,N)' figure(3), plot(X(1,:),X(2,:),'.'); figure(3), axis equal figure(3), axis(-7 7 -7 7)% Generate and plot the fourth dataset (case #4) m=0 0'S=0.2

8、 0;0 2;N=500;X = mvnrnd(m,S,N)' figure(4), plot(X(1,:),X(2,:),'.'); figure(4), axis equal figure(4), axis(-7 7 -7 7)% Generate and plot the fifth dataset (case #5) m=0 0'S=2 0;0 0.2;N=500;X = mvnrnd(m,S,N)' figure(5), plot(X(1,:),X(2,:),'.');figure(5), axis equal figure(5

9、), axis(-7 7 -7 7)% Generate and plot the sixth dataset (case #6) m=0 0'S=1 0.5;0.5 1;N=500;X = mvnrnd(m,S,N)'figure(6), plot(X(1,:),X(2,:),'.');figure(6), axis equalfigure(6), axis(-7 7 -7 7)% Generate and plot the seventh dataset (case #7) m=0 0'S=.3 0.5;0.5 2;N=500;X = mvnrnd(m,S,N)'figure(7), plot(X(1,:),X(2,:),'.');figure(7), axis equal figure(7), axis(-7 7 -7 7)% Generate and plot the eighth dataset (case #8) m=0 0

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论