Reputation: 5039
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.
Upvotes: 1
Views: 5482
Reputation: 124563
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
Upvotes: 0
Reputation: 2638
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.
Upvotes: 3