Gaussian Basis Function

吃可爱长大的小学妹 提交于 2019-12-07 09:35:28

To sample from a multivariate normal distribution, use the MVNRND function from the Statistics Toolbox. Example:

MU = [2 3];                    %# mean
COV = [1 1.5; 1.5 3];          %# covariance (can be isotropic/diagonal/full)
p = mvnrnd(MU, COV, 1000);     %# sample 1000 2D points
plot(p(:,1), p(:,2), '.')      %# plot them

With each Gaussian basis associate a center of the same dimension as the input, lets call it c. If x is your input, you can compute the output as

y = exp( - 0.5 * (x-c)'*(x-c) )

This will work with any dimension of x and c, provided they are the same. A more general form is

y = sqrt(det(S)) * exp( - 0.5 * (x-c)'* S * (x-c) )

where S is some positive definite matrix, well the inverse covariance matrix. A simple case is to take S to be a diagonal matrix with positive entries on the diagonals.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!