Gaussian Basis Function

♀尐吖头ヾ 提交于 2019-12-08 04:43:25

问题


Can you please tell me how can I model a Gaussian Basis Function in a 2 Dimensional Space in order to obtain a scalar output?

I know how to apply this with a scalar input, but I don't understand how should I apply it to a 2 dimensional vector input. I've seen many variations of this that I am confused.


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/4041866/gaussian-basis-function

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