Mercurial > hg > machine-learning-hw6
view gaussianKernel.m @ 1:e0f1290d2b43
Initial submission of work
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Sun, 27 Nov 2011 23:18:00 -0500 |
parents | f602dc601e9e |
children |
line wrap: on
line source
function sim = gaussianKernel(x1, x2, sigma) ##RBFKERNEL returns a radial basis function kernel between x1 and x2 ## sim = gaussianKernel(x1, x2) returns a gaussian kernel between x1 and x2 ## and returns the value in sim ## Ensure that x1 and x2 are column vectors x1 = x1(:); x2 = x2(:); sim = exp ( -sumsq (x1-x2)/(2*sigma^2)); endfunction