37 static function PlotManagerpm =
EpsLoss(
double ep) {
44 lx = max(0, abs(x)-ep);
47 sprintf(
" \\epsilon-insensitive loss function for \\epsilon=%g ",ep),...
48 " value ",
" epsilon-norm ");
49 plot(h,x,zeros(size(x)),
" k-- ",x,lx,
" b ",[0 0+eps],[-ep/3 max(lx)],
" black-- ");
52 annotation(gcf,
" textbox ",[0.4258 0.113 0.0461 0.07664],...
53 " String ",[
" -\epsilon "],...
54 " FontWeight ",
" bold ",...
55 " FontSize ",20,
" LineStyle ",
" none ");
58 annotation(gcf,
" textbox ",[0.5858 0.1229 0.0394 0.06729],...
59 " String ",[
" \epsilon "],...
60 " FontWeight ",
" bold ",...
61 " FontSize ",20,
" LineStyle ",
" none ");
63 axis([x(1) x(end) -ep/3 max(lx)]);
96 fx = fx ./ max(abs(fx));
98 svr = general.regression.ScalarEpsSVR_SMO;
105 kernel = kernels.GaussKernel(.8);
106 svr.K= kernel.evaluate(x,x);
107 kexp = kernels.KernelExpansion;
109 [ai, svidx] = svr.computeKernelCoefficients(fx,[]);
110 kexp.Centers.xi= x(:,svidx);
112 afx = kexp.evaluate(x);
114 h = pm.nextPlot(
" svr_smo ",sprintf(
" It: %d, #SV=%d, eps=%f ",...
115 svr.LastIterations,length(svidx),svr.Eps),
" x ",
" f(x) ");
116 demos.SVR.plotSVR(h, x, fx, afx, svr.Eps, svidx);
145 ip.addParamValue(
'Version',2);
146 ip.addParamValue(
'Steps',8);
149 ip.addParamValue(
'PM',pmd);
150 ip.addParamValue(
'Gamma',.8);
151 ip.addParamValue(
'Eps',.1);
152 ip.parse(varargin[:]);
157 fx = fx ./ max(abs(fx));
159 svr = general.regression.ScalarEpsSVR_SMO;
160 svr.Version= r.Version;
165 kernel = kernels.GaussKernel(r.Gamma);
166 svr.K= kernel.evaluate(x,x);
167 kexp = kernels.KernelExpansion;
173 [ai, svidx] = svr.computeKernelCoefficients(fx,[]);
174 kexp.Centers.xi= x(:,svidx);
176 afx = kexp.evaluate(x);
178 h = r.PM.nextPlot(sprintf(
" iter%d ",
l),...
179 sprintf(
" Iteration %d ",
l),
" x ",
" f(x) and approximation ");
180 demos.SVR.plotSVR(h, x, fx, afx, svr.Eps, svidx);
221 plot(h,x,fx,
" r ",x,[fx-eps; fx+eps],
" r-- ");
226 skipped = setdiff(1:length(x),svidx);
227 plot(h,x(svidx),fx(svidx),
" k. ",
" MarkerSize ",16);
SVR: Support vector machine related KerMor demos.
static function ScalarEpsSVR_SMO(integer version,PlotManager pm)
Demonstrates the general.regression.ScalarEpsSVR_SMO class.
PlotManager: Small class that allows the same plots generated by some script to be either organized a...
logical LeaveOpen
Flag indicating if the plots should be left open once the PlotManager is deleted (as variable) ...
A variable number of input arguments.
function axes ax_handle = nextPlot(char tag,char caption,char xlab,char ylab,cell< char > leg_str,integer numsubplots)
Creates a new axis to plot in. Depending on the property tools.PlotMananger.Single this will either a...
static function ScalarEpsSVR_SMO_SingleSteps(varargin)
Demonstrates the general.regression.ScalarEpsSVR_SMO class.
static function PlotManager pm = EpsLoss(double ep)
Plots the epsilon-insensitive loss function for a given epsilon.