-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathregLS.m
More file actions
18 lines (14 loc) · 771 Bytes
/
regLS.m
File metadata and controls
18 lines (14 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
% |----------------------------------------------------------------------------
% |'regLS' is a function. It takes a N x (M + 1) design matrix ('data.X'), a
% |N x 1 target vector ('data.y'), and a penalty factor
% |('calOpt.reglsPenalty'). It returns a (M + 1) x 1 parameter vector
% |('model.mean') by applying the method of linear regularized least-squares
% |(regLS) linear regression.
% |For more details, consult the reBoot manual available at
% |<http://www.reiher.ethz.ch/software/reboot/manual.pdf>.
% |----------------------------------------------------------------------------
function model = regLS(data,calOpt)
M = size(data.X,2) - 1;
model.mean = inv(data.X' * data.X + calOpt.reglsPenalty * eye(M + 1)) ...
* data.X' * data.y;
end