1 %> @brief B-Splines Decomposition
4 %> Ramsay JO. MATLAB, R and S-PLUS Functions
for Functional Data Analysis. 2005:1-66.
6 %> (Accessed on 10/Dec/2010)
7 %> @todo Should make the basis on training, not only use!
9 %> @sa uip_fcon_spline.m
12 %> Number of basis functions transformed dataset (
default: 30).
14 %> Breakpoints, given in x-axis indexes, in
case one wants to fine-tune the splines (optional) (see reference).
16 %> Splines order (
default: 6) (see reference).
20 properties(SetAccess=
protected)
21 %> New feature x-axis. See that
this transformation keeps the x-axis unit!
27 o.classtitle = 'B-Splines Decomposition';
28 o.
short = 'B-Splines';
33 methods(Access=protected)
34 function o = do_train(o, data)
36 bb = create_bspline_basis([1, data.nf], o.no_basis, o.order);
38 bb = create_bspline_basis([1, data.nf], o.no_basis, o.order, round(o.breaks));
41 % First makes a new x vector.
42 % It will contain the x-axis location where the splines peak
43 PREC = 1000; % This number only determines the precision and does not affect anything else.
45 tt2 = linspace(1, data.nf, PREC);
47 p = polyfit(tt, [data.fea_x], min(data.nf-1, 10));
50 basismat = eval_basis(tt2, bb); % bases
as columns
51 [vals, idxs] = max(basismat);
52 o.fea_x_new = x2(idxs);
56 % We gotta get the loadings matrix
58 B = eval_basis(tt3, bb);
59 o.L = B/(B'*B); % L, the "loadings" matrix calculated by Least-Squares
60 o.L_fea_x = data.fea_x;
65 function data = do_use(o, data)
66 data = data.transform_linear(o.L, o.L_fea_prefix);
67 data.fea_x = o.fea_x_new;
Feature Construction - Linear Transformations base class.
Analysis Session (AS) base class.