264 error(
" No ExpConfig set. Aborting. ");
266 error(
" Need at least one expansion configuration. ");
272 s = max(abs(fm),abs(fM));
275 oldvalfxi = avd.fxi.toMemoryMatrix;
276 atd.
fxi(:,:) = oldfxi ./ repmat(s,1,size(atd.
fxi,2));
279 avd.fxi(:,:) = oldvalfxi ./ repmat(s,1,size(avd.fxi,2));
291 kexp.Ma= this.ScalingG*kexp.Ma;
292 atd.
fxi(:,:) = oldfxi;
294 avd.fxi(:,:) = oldvalfxi;
302 n = size(kexp.Centers.xi,2);
303 hlp = sum(abs(kexp.Ma) ~= 0,1);
304 usedidx = find(hlp > 0);
310 if length(usedidx) < n
311 kexp.Ma= kexp.Ma(:,usedidx);
312 kexp.Centers.xi= kexp.Centers.xi(:,usedidx);
313 if isfield(kexp.Centers,
" ti ") && ~isempty(kexp.Centers.ti)
314 kexp.Centers.ti= kexp.Centers.ti(:,usedidx);
316 if isfield(kexp.Centers,
" mui ") && ~isempty(kexp.Centers.mui)
317 kexp.Centers.mui= kexp.Centers.mui(:,usedidx);
322 if sum(hlp) / numel(kexp.Ma) < .5
323 kexp.Ma= sparse(kexp.Ma);
334 str = [str sprintf(
" Total computation time for %d configurations: %gs (%gmin,%gh)\n ",...
335 ec.getNumConfigurations,
this.LastCompTime,...
336 this.LastCompTime/60,
this.LastCompTime/3600)];
338 str = [str sprintf(
" Best expansion configuration at index %d:\n%s\n ",this.
BestExpConfig,...
339 ec.getConfigurationString(
this.BestExpConfig))];
342 str = [str sprintf(
" Expansion configuration ranges:\n%s\n ",...
358 context =
" Summary ";
365 str = sprintf(
" %s: Max absolute training errors ",context);
366 h = pm.nextPlot(
" maxerrors ",str,...
367 " expansion size ",
" error ");
372 str = sprintf(
" %s: Max relative training errors ",context);
373 h = pm.nextPlot(
" maxrelerrors ",str,...
374 " expansion size ",
" error ");
379 str = sprintf(
" %s: Absolute validation errors ",context);
380 h = pm.nextPlot(
" valerrors ",str,...
381 " configuration nr ",
" error ");
383 legend(
" max ",
" mean ");
385 str = sprintf(
" %s: Relative validation errors ",context);
386 h = pm.nextPlot(
" valrelerrors ",str,...
387 " configuration nr ",
" error ");
389 legend(
" max ",
" mean ");
411 [val, idx] = max(errs);
451 static function this =
loadobj(
this,initfrom) {
456 if isfield(initfrom,
" ExpConfig ")
459 if isfield(initfrom,
" MaxErrors ") && ~isempty(initfrom.MaxErrors)
461 elseif isfield(initfrom,
" err ")
462 this.MaxErrors= initfrom.err;
464 if isfield(initfrom,
" MaxRelErrors ") && ~isempty(initfrom.MaxRelErrors)
466 elseif isfield(initfrom,
" relerr ")
467 this.MaxRelErrors= initfrom.relerr;
469 if isfield(initfrom,
" ValidationErrors ") && ~isempty(initfrom.ValidationErrors)
472 if isfield(initfrom,
" ValidationRelErrors ") && ~isempty(initfrom.ValidationRelErrors)
475 if ~isfield(initfrom,
" StopFlags ") || isempty(initfrom.StopFlags)
476 this.
StopFlags= zeros(size(this.MaxErrors));
481 this.
StopFlags= zeros(size(this.MaxErrors));
matrix< double > ValidationErrors
For each configuration, contains a row with the maximum errors on the validation data. The number of columns depends on the type of algorithm implemented by the subclasses.
function double t = getValueRanges()
matrix< double > MaxRelErrors
For each configuration, contains a row with the maximum relative errors on the training data...
matrix< integer > StopFlags
For each effective configuration, the stop flags are stored here.
data.FileMatrix xi
The state space samples , stored row-wise in a data.FileMatrix instance.
function nc = getTotalNumConfigurations()
ICLONEABLE Interface for cloneable handle classes.
virtual function integer n = getNumConfigurations()
Returns the number of configurations that can be applied.
data.FileMatrix fxi
The evaluations of , stored row-wise in a data.FileMatrix.
IClassConfig StateConfig
The state space kernel configuration.
integer BestExpConfig
Index of the best expansion config determined by the algorithm.
Base class for any KerMor class.
function registerProps(varargin)
Call this method at any class that defines DPCM observed properties.
matrix< double > ValidationRelErrors
For each configuration, contains a row with the maximum relative errors on the validation data...
kernels.config.ExpansionConfig ExpConfig
The different kernel expansion configurations to try.
A MatLab function handle.
PlotManager: Small class that allows the same plots generated by some script to be either organized a...
function copy = clone(copy)
The interface method with returns a copy of the current class instance.
rowvec ti
The time samples .
function fx = evaluate(matrix x, varargin)
Evaluates the kernel expansion.
double LastCompTime
The computation time for the last run in seconds.
function kernels.KernelExpansion kexp = computeApproximation(data.ApproxTrainData atd, avd)
KerMorObject()
Constructs a new KerMor object.
function [ double val , integer idx , rowvec errs ] = getError(kernels.KernelExpansion kexp,data.ApproxTrainData atd)
Computes the error according to the chosen error function (see ErrorFun property) with respect to the...
function_handle ErrorFun
The error function to apply on each data vector.
IReductionSummaryPlotProvider:
disp
Handle object disp method which is called by the display method. See the MATLAB disp function...
function n = getNumConfigurations()
Returns the number of configurations that can be applied.
virtual function templateComputeApproximation(kernels.KernelExpansion kexp,data.ApproxTrainData atd, avd)
Performs the actual approximation after scaling.
matrix mui
The parameter samples used computing the parent trajectories of .
UsefScaling
Flag that determines whether the approximation center f values should be scaled to [-1...
ScalingG
If UsefScaling is set to true, this matrix contains the scaling matrix which has to be used in sub-al...
matrix< double > MaxErrors
For each configuration, contains a row with the maximum errors on the training data. The number of columns depends on the type of algorithm implemented by the subclasses.
function str = object2str(handle obj,integer maxdepth)
object2str: Generic matlab object to string converter.
ABase: Base class for any approximation generation algorithms for kernel expansions,.
function copy = clone(copy)
The interface method with returns a copy of the current class instance.
function [ str , rangetab ] = getApproximationSummary()
Setup.
static function rowvec< double > n = L2(matrix< double > x)
Returns the discrete norm for each column vector in x.
ApproxTrainData: Data class for approximation training data, containing several useful bounding box p...
ExpansionConfig: Base class config for kernel expansions.
Norm: Static class for commonly used norms on sets of vectors.
function A = toMemoryMatrix()
Converts this FileMatrix to a full double matrix.
A MatLab character array.
static function this = loadobj(this, initfrom)
function [ rowmin , rowmax ] = getColBoundingBox()
Computes the bounding box of the matrix with respect to columns.
function plotSummary(pm, context)
KernelExpansion: Base class for state-space kernel expansions.