一、lasso
二、前向逐步回归
前向逐步回归算法可以得到与lasso差不多的效果,但是前向逐步回归更加简单。这是一种贪心算法,在每一步尽量减少误差。...for j = 1:n
xDeal(i,j) = (x(i,j)-xMean(j))/xVar(j);
end
end
%% 训练
runtime = 5000;%迭代的步数...(:,i));
end
前向逐步回归函数
function [ wResult ] = stageWise( x, y, eps, runtime)
[m,n] = size(x);%数据集的大小...wResult = zeros(runtime, n);%最终的结果
w = zeros(n,1);
wMax = zeros(n,1);
for i = 1:runtime...ws = w'%输出每一次计算出来的权重
lowestError = inf;%定义最小值
for j = 1:n
for sign