74 this =
this@general.regression.BaseQPSVR;
84 function [ai , sf ] =
regress(fxi,ainit) {
86 T = [diag(ones(1,m)) -diag(ones(1,m))];
91 c = (this.
Eps*ones(2*m,1) - (fxi*T)^
t);
101 ub = ones(2*m,1)*(this.
C/m);
104 p = this.
solve(Q,c,lb,ub,[],[],[],ainit);
125 #if 0 //mtoc++: 'set.Eps'
126 function
Eps(value) {
128 error(" Value must be a positive real scalar ");
139 copy = general.regression.ScalarEpsSVR;
141 copy =
clone@general.regression.BaseQPSVR(
this, copy);
167 svr = general.regression.ScalarEpsSVR;
175 kernel = kernels.GaussKernel(.5);
176 svr.K= kernel.evaluate(x,x);
179 plot(x,fx,
" r ",x,[fx-svr.Eps; fx+svr.Eps],
" r-- ");
181 [ai, svidx] = svr.computeKernelCoefficients(fx, []);
183 svfun = @(x)ai
" *(kernel.evaluate(x,sv) ");
187 fdiff = abs(fsvr(svidx)-fx(svidx));
188 errors = find(fdiff < .999*svr.Eps);
189 res = isempty(errors);
193 plot(x,fsvr,
" b ",x,[fsvr-svr.Eps; fsvr+svr.Eps],
" b-- ");
194 skipped = setdiff(1:length(x),svidx);
195 plot(sv,fx(svidx),
" .r ",x(skipped),fx(skipped),
" xr ");
198 plot(x(svidx(errors)),fx(svidx(errors)),
" blackx ",
" LineWidth ",4);
201 tit = sprintf(
" #SV=%d, eps=%f ",length(svidx),svr.Eps);
215 x = [0 0.3000 0.6000 0.9000;
216 0.8321 1.0756 1.3557 1.6539];
217 fx = [0.7393 0.8799 0.9769 0.9966];
219 svr = general.regression.ScalarEpsSVR;
222 kernel = kernels.GaussKernel(1);
223 svr.K= kernel.evaluate(x,x);
227 plot(xp,fx,
" r ",xp,[fx-svr.Eps; fx+svr.Eps],
" r-- ");
229 [ai,svidx] = svr.regress(fx);
231 svfun = @(x)ai^
t*kernel.evaluate(sv,x);
237 plot(xp,fsvr,
" b ",xp,[fsvr-svr.Eps; fsvr+svr.Eps],
" b-- ");
238 skipped = setdiff(1:length(x),svidx);
239 plot(sv(1,:),fx(svidx),
" .r ",xp(skipped),fx(skipped),
" xr ");
function [ p , d , info ] = solve(matrix Q,colvec c,colvec lb,colvec ub,matrix A,matrix Alb,matrix Aub, x0)
Solves the given quadratic problem according to the subclasses' algorithm.
static function res = test_ScalarEpsSVR()
Performs a test of this class.
function registerProps(varargin)
Call this method at any class that defines DPCM observed properties.
ScalarEpsSVR()
Default constructor. Calls superconstructor to initialize properties.
static const SUCCESS
Algorithm terminated otherwisely successful.
BaseQPSVR: SVR variant that is solved using quadratic programs.
data.FileMatrix K
The kernel matrix to use.
function copy = clone()
Create new instance.
disp
Handle object disp method which is called by the display method. See the MATLAB disp function...
static function test2_CustomSVR()
Performs a test of this class.
ScalarEpsSVR: Scalar support vector regression.
double C
The weighting of the slack variables.
function [ ai , sf ] = regress(fxi, ainit)
Performs epsilon-SVR regression.
Eps
The margin for the approximation-to-source distance. Effectiveness also depends on C...
function res = isposrealscalar(value)
isposintscalar: Backwards-compatibility function for matlab versions greater than 2012a ...
StopFlag: Flags that algorithms can use to specify the reason for their termination.