KerMor  0.9
Model order reduction for nonlinear dynamical systems and nonlinear approximation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BaseScalarSVR.m
Go to the documentation of this file.
1 namespace general{
2 namespace regression{
3 
4 
5 /* (Autoinserted by mtoc++)
6  * This source code has been filtered by the mtoc++ executable,
7  * which generates code that can be processed by the doxygen documentation tool.
8  *
9  * On the other hand, it can neither be interpreted by MATLAB, nor can it be compiled with a C++ compiler.
10  * Except for the comments, the function bodies of your M-file functions are untouched.
11  * Consequently, the FILTER_SOURCE_FILES doxygen switch (default in our Doxyfile.template) will produce
12  * attached source files that are highly readable by humans.
13  *
14  * Additionally, links in the doxygen generated documentation to the source code of functions and class members refer to
15  * the correct locations in the source code browser.
16  * However, the line numbers most likely do not correspond to the line numbers in the original MATLAB source files.
17  */
18 
20  :public KerMorObject,
21  public ICloneable,
22  public IKernelCoeffComp {
50  public: /* ( setObservable ) */
51 
72  /* (Transien*/
73 public:
74 
91  public: /* ( Dependent, setObservable ) */
92 
110  protected:
111 
112  double C = .5;
131  private:
132 
133  fLambda = 1;
142  public:
143 
145  this = this@KerMorObject;
146  this.registerProps(" K "," Lambda "," AlphaRelMinValue ");
147  }
148 
149 
150  function target = clone(target) {
151  if nargin < 2
152  error(" Must call this method from subclasses, passing the subclass instance as 'target'. ");
153  end
154  target.K= this.K;
155  target.C= this.C;
156  target.fLambda= this.fLambda;
157  target.AlphaRelMinValue= this.AlphaRelMinValue;
158  }
159 
160 
161 
162 #if 0 //mtoc++: 'set.K'
163 function K(value) {
164  if (isa(value," handle ") && ~isa(value, " data.FileMatrix ")) || (~ismatrix(value) || ~isa(value," double "))
165  error(" Value must be a data.FileMatrix or a double matrix. ");
166  end
167  this.K= value;
168  }
169 
170 #endif
171 
172 
173 
174 #if 0 //mtoc++: 'set.Lambda'
175 function Lambda(value) {
176  if ~isposrealscalar(value)
177  error(" Lambda must be a positive real scalar ");
178  end
179  this.fLambda= value;
180  this.C= 1/(2*value);
181  }
182 
183 #endif
184 
185 
186 
187 #if 0 //mtoc++: 'get.Lambda'
188 function value = Lambda() {
189  value = this.fLambda;
190  }
191 
192 #endif
193 
194 
195 
196 #if 0 //mtoc++: 'set.AlphaRelMinValue'
197 function AlphaRelMinValue(value) {
198  if ~isposrealscalar(value)
199  error(" AlphaRelMinValue must be a positive real scalar ");
200  end
201  this.AlphaRelMinValue= value;
202  }
203 
204 #endif
205 
206 
207  function init(kernels.KernelExpansion kexp) {
208  this.K= kexp.getKernelMatrix;
209  }
221  function [rowvecci , integersvidx , sf ] = computeKernelCoefficients(rowvec yi,initialai) {
222  [ci, sf] = this.regress(yi, initialai);
223  svidx = find(abs(ci) ./ max(abs(ci)) > this.AlphaRelMinValue);
224  ci = ci(svidx);
225  if isempty(svidx)
226  ci = 0;
227  svidx = 1;
229  end
230  }
246  public: /* ( Abstract ) */
247 
248  virtual function [ci , integersf ] = regress(fxi,rowvec initialai) = 0;
277 };
278 }
279 }
280 
function target = clone(target)
The interface method with returns a copy of the current class instance.
virtual function [ ci , integer sf ] = regress(fxi,rowvec initialai)
Performs the actual regression (template method)
ICLONEABLE Interface for cloneable handle classes.
Definition: ICloneable.m:17
double AlphaRelMinValue
Minimum relative value for any alpha to be considered a support vector coefficient.
Definition: BaseScalarSVR.m:52
function [ rowvec ci , integer svidx , sf ] = computeKernelCoefficients(rowvec yi, initialai)
Implementation of the kernels.ICoeffComp interface.
A double value.
Base class for any KerMor class.
Definition: KerMorObject.m:17
function registerProps(varargin)
Call this method at any class that defines DPCM observed properties.
Definition: DPCMObject.m:125
KerMorObject()
Constructs a new KerMor object.
Definition: KerMorObject.m:55
function ismat = ismatrix(value)
ismatrix: Compatibility function for matlab versions smaller than 2011b
Definition: ismatrix.m:17
data.FileMatrix K
The kernel matrix to use.
Definition: BaseScalarSVR.m:75
function K = getKernelMatrix()
Computes the kernel matrix for the currently set center data.
Interface for kernel expansion coefficient computation.
double C
The weighting of the slack variables.
SCALARSVR Scalar support vector regression.
Definition: BaseScalarSVR.m:19
static const NO_SUPPORT_VECTORS_FOUND
SVR-specific flag that indicates that no support vectors have been found.
Definition: StopFlag.m:92
FileMatrix: File-based matrix which stores sets of columns in separate files.
Definition: FileMatrix.m:18
A matlab row vector.
function res = isposrealscalar(value)
isposintscalar: Backwards-compatibility function for matlab versions greater than 2012a ...
function init(kernels.KernelExpansion kexp)
% IKernelCoeffComp interface members Sets the kernel matrix.
double Lambda
The regularization parameter for the primary minimization problem.
Definition: BaseScalarSVR.m:93
KernelExpansion: Base class for state-space kernel expansions.
StopFlag: Flags that algorithms can use to specify the reason for their termination.
Definition: StopFlag.m:17