51 this =
this@kernels.BellFunction;
58 this.updateGammaDependants;
59 this.
addlistener(
" Gamma ",
" PostSet ",@this.updateGammaDependants);
89 if size(x,2) > 1 && size(y,2) > 1
90 error(
" One argument must be a vector. ");
93 error(
" Not yet implemented correctly. ");
99 hlp = bsxfun(@minus,x,y);
100 hlp = -2*hlp/this.
Gamma^2;
101 Nablax = bsxfun(@times,hlp,this.
evaluate(x, y));
116 dx = -2*r/this.
Gamma^2 .* exp(-r.^2/
this.Gamma^2);
127 ddx = (2/this.
Gamma^2) * (2*r.^2/
this.Gamma^2-1) .* exp(-r.^2/
this.Gamma^2);
138 phi = exp(-r.^2/
this.Gamma^2);
153 g = dist/sqrt(-log(ep));
157 fprintf(
" Setting Gamma = %12.20f\n ",g);
178 copy = kernels.GaussKernel;
179 copy.Gamma= this.
Gamma;
180 copy =
clone@kernels.BellFunction(
this, copy);
186 function updateGammaDependants(unused1,unused2) {
201 if ~isa(obj,
" kernels.GaussKernel ")
202 newinst = kernels.GaussKernel;
203 newinst.Gamma= obj.Gamma;
204 newinst.updateGammaDependants;
205 obj =
loadobj@kernels.BellFunction(newinst, obj);
207 obj =
loadobj@kernels.BellFunction(obj);
209 obj.addlistener(
" Gamma ",
" PostSet ",@this.updateGammaDependants);
216 ki = general.interpolation.KernelInterpol;
217 ki.UseNewtonBasis=
false;
218 kexp = kernels.KernelExpansion;
219 k = kernels.GaussKernel;
225 epsteps = 0.05:.05:.95;
226 dlog = zeros(3,length(epsteps));
227 for epidx=1:length(epsteps)
229 k.setGammaForDistance(dx,ep);
230 for idx = 1:length(x)
238 kexp.Ma= ki.interpolate(fx2);
240 fxi = kexp.evaluate(x);
241 diff(idx) = abs(fx(idx) - fxi(idx));
245 dlog(2,epidx) = min(diff);
246 dlog(3,epidx) = max(diff);
249 [~, idx] = min(dlog(2,:));
250 fprintf(
" Min distance: %f at ep=%f\n ",dlog(2,idx),dlog(1,idx));
261 x = (-1.2:.01:1.2)+c;
263 x2 = [
X(:)
" ; Y(:) "];
264 k = kernels.GaussKernel;
265 kexp = kernels.KernelExpansion;
270 for n = 1:length(conf)
272 g =
k.setGammaForDistance(d,eps);
273 tag = strrep(sprintf(
" g_1d_d%d_g%g ",d,g),
" . ",
" _ ");
274 h = pm.nextPlot(tag,sprintf(
" Gauss kernel with dist=%d,\\gamma=%g on 1D data ",d,g));
275 plot(h,x,kexp.evaluate(x));
277 kexp.Centers.xi= [c; c];
278 for n = 1:length(conf)
280 g =
k.setGammaForDistance(d,eps);
281 tag = strrep(sprintf(
" g_2d_d%d_g%g ",d,g),
" . ",
" _ ");
282 h = pm.nextPlot(tag,sprintf(
" Gauss kernel with dist=%d,\\gamma=%g on 2D data ",d,g));
283 surf(h,
X,
Y,
reshape(kexp.evaluate(x2),length(x),[]),
" EdgeColor ",
" none ");
Radial Basis Function Kernel.
function g = setGammaForDistance(dist, ep)
Computes the value for which the Gaussian is smaller than in a distance of dist, i.e. Returns the computed value AND sets the kernel's Gamma property to this value.
function K = evaluate(matrix< double > x,matrix< double > y)
Evaluates the gaussian.
BELLFUNCTION Summary of this class goes here Detailed explanation goes here.
function registerProps(varargin)
Call this method at any class that defines DPCM observed properties.
reshape
hanges the dimensions of the handle object array to the specified dimensions. See the MATLAB reshape ...
function dx = evaluateD1(r)
Method for first derivative evaluation.
PlotManager: Small class that allows the same plots generated by some script to be either organized a...
function phi = evaluateScalar(r)
Implements the required method from the IRotationInvariant interface.
double Gamma
Univariate scaling.
function ddx = evaluateD2(r)
Method for second derivative evaluation.
r0
Point of maximum first derivative on scalar evaluation.
static function obj = loadobj(obj)
disp
Handle object disp method which is called by the display method. See the MATLAB disp function...
static function res = test_InterpolGamma()
function r = getSqDiffNorm(matrix< double > x,matrix< double > y)
Returns the weighted squared norm of the difference .
Global configuration class for all KerMor run-time settings.
static function [ res , pm ] = test_GaussKernel(pm)
static function KerMor theinstance = App()
The singleton KerMor instance.
addlistener
Creates a listener for the specified event and assigns a callback function to execute when the event ...
GaussKernel(double Gamma)
Creates a new GaussKernel.
function Nablax = getNabla(colvec< double > x,matrix< double > y)
Method for first derivative evaluation.