conpred1.m

来自「偏最小二乘算法在MATLAB中的实现」· M 代码 · 共 32 行

M
32
字号
function cm = conpred1(b,w,p,q,lv)
%CONPRED1 Converts PLS models to regression vectors
%  The inputs are the inner-relation coefficients (b),
%  the x-block weights (w), the x-block loadings (p), the
%  y-block loadings (q) and the number of latent variables
%  to consider (lv). The output is a the final regression
%  vector (cm) (or matrix if y is multivariate).
%  The I/O format is cm = conpred1(b,w,p,q,lv);
%
%  CONPRED1 works with either single or multiple variable y-block 
%  PLS models.

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

[rq,cq] = size(q);
m = conpred(b,w,p,q,lv);
if lv == 1
  cm = m';
else
  if rq == 1
    cm = (sum(m))';
  else
    cm = m(1:rq,:)';
    for i = 1:lv-1
      cm = cm + m(i*rq+1:(i+1)*rq,:)';
    end
  end
end

⌨️ 快捷键说明

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