⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 plspred.m

📁 偏最小二乘算法在MATLAB中的实现
💻 M
字号:
function ypred = plspred(x,b,p,q,w,lv)
%PLSPRED Predictions based on existing PLS model.
%  The inputs are the matrix of predictor variables (x),
%  the PLS model inner-relation coefficients (b), the
%  x-block loadings (p), the y-block loadings (q),
%  the x-block weights (w), and the number of  latent 
%  variables to use in prediction (lv). The output is
%  the vector or matrix of the predicted values (ypred).
%  I/O format is: ypred = plspred(x,b,p,q,w,lv);

%  Copyright
%  Barry M. Wise
%  1991
%  Modified by B.M. Wise, November 1993

[mx,nx] = size(x);
[mq,nq] = size(q);
[mw,nw] = size(w);
that = zeros(mx,lv);
ypred = zeros(mx,mq);
if lv > nw
  s = sprintf('Maximum number of latent variables exceeded (Max = %g)',nw);
  error(s)
end
for i = 1:lv
  that(:,i) = x*w(:,i);
  x = x - that(:,i)*p(:,i)';
end
for i = 1:lv
  ypred = ypred + b(1,i)*that(:,i)*q(:,i)';
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -