1 %> @brief Principal Component Analysis
6 %> = 1: whether to rotate factors or not.
7 flag_rotate_factors = 0;
8 %> = 10: number of factors to feature in the transformed dataset.
14 o.classtitle = 'Principal Component Analysis';
17 o.L_fea_prefix = 'PC';
21 methods(Access=protected)
23 function o = do_train(o, data)
24 if sum(var(data.X) < 1e-10) > 0
25 irverbose('WARNING: There are variables with variance lower than 1e-10, something may go wrong here!', 3);
31 no_factors_eff = min(o.no_factors, size(V_star, 2));
32 V_star = V_star(:, 1:no_factors_eff);
34 no_factors_eff = size(V_star, 2);
37 if o.flag_rotate_factors
43 o.L_fea_x = data.fea_x;
48 %> Overriden to imprint variance percentages in feature names
49 function data = do_use(o, data)
51 totalVar = sum(diag(C));
54 varNow = var(data.X(:, i))/totalVar*100;
55 data.fea_names{i} = sprintf(
'%s%d (%.3g%%)', o.L_fea_prefix, data.fea_x(i), varNow);
Principal Component Analysis.
function irverbose(in s, in level)
Feature Construction - Linear Transformations base class.
function rotatefactors2(in L, in flag_normal)