亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? parafac.m

?? PLS_Toolbox是用于故障檢測(cè)與診斷方面的matlab工具箱
?? M
字號(hào):
function model = parafac(mwa,nocomp,scl,tol,x0,ls,plots,nn);
%PARAFAC Parallel factor analysis for n-way arrays
%  PARAFAC will decompose an array of order n (where n >= 3)
%  into the summation over the outer product of n vectors.
%  The inputs are the multi-way array to be decomposed
%  (mwa), the number of components to estimate (nocomp), and
%  the optional inputs of a cell array of vectors for plotting
%  loads against (scl), the converge tolerance (tol, a 1 by 3
%  vector consisting of the relative change in fit, absolute change
%  in fit and maximum iterations, default is tol = [1e-6 1e-6 10000]), 
%  the initial estimate of the factors (x0), a flag (ls) which turns
%  off the line search options when set to zero, and a flag (plots)
%  which turns off the plotting of the loads and residuals when set
%  to zero. The output is a structured array (model) containing the 
%  PARAFAC model elements:
%
%     xname: name of the original workspace input variable
%      name: type of model, always 'PARAFAC'
%      date: model creation date stamp
%      time: model creation time stamp
%      size: size of the original input array
%     ncomp: number of components estimated
%       tol: tolerance vector used during model creation
%     final: final tolerances at termination
%       ssq: total and residual sum of squares
%     loads: 1 by order cell array of the loadings in each dimension
%       res: 1 by order cell array residuals summed over each dimension
%       scl: 1 by order cell array with scales for plotting loads 
%
%  This routine uses alternating least squares (ALS) in combination with
%  a line search every fifth iteration. For 3-way data, the intial estimate
%  of the loadings is obtained from the tri-linear decomposition (TLD).
%
%I/O: model = parafac(mwa,nocomp,scl,tol,x0,ls,plots);
%
%See also:  GRAM, MPCA, MWFIT, OUTER, OUTERM, TLD, UNFOLDM, XPLDST

%Copyright Eigenvector Research, Inc. 1998
%bmw March 4, 1998

mwasize = size(mwa);
order = ndims(mwa);
if (nargin < 3 | ~strcmp(class(scl),'cell'))
  scl = cell(1,order);
end
if (nargin < 4 | tol == 0)
  tol = [1e-6 1e-6 10000];
end
if nargin < 6
  ls = 1;
end
if nargin < 7
  plots = 1;
end
if nargin < 8
  nn = zeros(1,order);
end
% Initialize the routine if not already given
if (nargin < 5 | ~strcmp(class(x0),'struct') )
  x0 = cell(1,order);
  if order == 3
    % Initialize with TLD estimates
    m = tld(mwa,nocomp,0,0);
	x0 = m.loads;
  else
    for j = 1:order
      x0{1,j} = rand(mwasize(j),nocomp);
    end
  end
else
  if strcmp(class(x0),'struct')
    x0 = x0.loads;
  elseif ~strcmp(class(x0),'cell')
    error('Initial estimate x0 not a cell or structure')
  end
end
% Calculate total sum of squares in data
mwasq = mwa.^2;
tssq = sum(mwasq(:));

% Initialize the unfolded matrices
mwauf = cell(1,order);
mwauflo = cell(1,order);
mwaufsize = zeros(1,order);
for i = 1:order
  mwauf{i} = unfoldmw(mwa,i)';
  mwaufsize(i) = prod(mwasize)/mwasize(i);
  mwauflo{i} = zeros(prod(mwasize)/mwasize(i),nocomp);
end

% Initialize other variables needed in the ALS
oldx0 = x0;
searchdir = x0;
iter = 0;
flag = 0;
oldests = zeros(prod(mwasize)*nocomp,1);
% Start the ALS
while flag == 0;
  iter = iter+1;
  % Loop over each of the order to estimate
  for i = 1:order
    % Multiply the loads of all the orders together
    % except for the order to be estimated
    for j = 1:nocomp
      if i == 1
        mwvect = x0{2}(:,j);
        for k = 3:order  
          mwvect = mwvect*x0{k}(:,j)';
          mwvect = mwvect(:);
	    end
	  else
        mwvect = x0{1}(:,j);
        for k = 2:order
          if k ~= i
            mwvect = mwvect*x0{k}(:,j)';
            mwvect = mwvect(:);
          end
	    end
      end
      mwauflo{i}(:,j) = mwvect;
    end	
    % Regress the actual data on the estimate to get new loads in order i
    if nn(i) == 0 %| iter < 3)
	  ordiest = mwauflo{i}\mwauf{i};
    else
      ordiest = zeros(nocomp,mwasize(i));
      for k = 1:mwasize(i)
        [mwauflo{i} mwauf{i}(:,k)], x0{i}(k,:)'
        ordiest(:,k) = fastnnls(mwauflo{i},mwauf{i}(:,k),1e-8,x0{i}(k,:)');
      end
      if any(sum(ordiest,2)==0);
        disp([mwauflo{i} mwauf{i}])
      end
    end
	% Normalize the estimates (except the last order) and store them in the cell
	if i ~= order
      x0{i} = ordiest'*diag(1./sqrt(sum(ordiest.^2,2)));
      ii = i+1;
    else
	  x0{i} = ordiest';
      ii = 1;
	end
  end
  % Calculate the estimate of the input array based on current loads
  mwaest = zeros(prod(mwasize),nocomp);
  for j = 1:nocomp
    mwavect = x0{1}(:,j);
    for ii = 2:order
      mwavect = mwavect*x0{ii}(:,j)';
      mwavect = mwavect(:);
    end
    mwaest(:,j) = mwavect;
  end
  mwaest = sum(mwaest,2);
  mwasq = reshape(mwaest,mwasize);
  % Check to see if the fit has changed significantly
  mwasq = (mwa-mwasq).^2;
  ssq = sum(mwasq(:));
  %disp(sprintf('On iteration %g ALS fit = %g',iter,ssq));
  if iter > 1
    abschange = abs(oldssq-ssq);
    relchange = abschange/ssq;
    if relchange < tol(1)
      flag = 1;
      disp('Iterations terminated based on relative change in fit error')
    elseif abschange < tol(2)
      flag = 1;
      disp('Iterations terminated based on absolute change in fit error')
    elseif iter > tol(3)
      flag = 1;
      disp('Iterations terminated based on maximum iterations')
    end
  end
  if iter/100 == round(iter/100)
    disp([iter relchange abschange])
  end
  oldssq = ssq;
  
  % Every fifth iteration do a line search if ls == 1
  if (iter/5 == round(iter/5) & ls == 1) 
    % Determine the search direction as the difference between the last two estimates
    for i = 1:order
      searchdir{i} = x0{i} - oldx0{i};
    end
    % Initialize other variables required for line search
    testmod = x0; 
    sflag = 0; 
    i = 0; 
    sd = zeros(10,1); 
    sd(1) = ssq;
    xl = zeros(10,1);
    while sflag == 0
      for k = 1:order
        testmod{k} = testmod{k} + (2^i)*searchdir{k};
      end
      % Calculate the fit error on the new test model
      mwasq = (mwa - outerm(testmod)).^2;
      % Save the difference and the distance along the search direction
      sd(i+2) = sum(mwasq(:));
      xl(i+2) = xl(i+1) + 2^i;
      i = i+1;
      % Check to see if a minimum has been exceeded once two new points are calculated
      if i > 1 
        if sd(i+1) > sd(i)
          sflag = 1;
          % Estimate the minimum along the search direction
          xstar = sum((xl([i i+1 i-1]).^2 - xl([i+1 i-1 i]).^2).*sd(i-1:i+1));
          xstar = xstar/(2*sum((xl([i i+1 i-1]) - xl([i+1 i-1 i])).*sd(i-1:i+1)));
          % Save the old model and update the new one
          oldx0 = x0;
          for k = 1:order
            x0{k} = x0{k} + xstar*searchdir{k};
          end
        end
      end
    end 
    % Calculate the estimate of the input array based on current loads
    mwaest = zeros(prod(mwasize),nocomp);
    for j = 1:nocomp
      mwavect = x0{1}(:,j);
      for ii = 2:order
        mwavect = mwavect*x0{ii}(:,j)';
        mwavect = mwavect(:);
      end
      mwaest(:,j) = mwavect;
    end
    mwaest = sum(mwaest,2);
    mwasq = reshape(mwaest,mwasize);
    mwasq = (mwa - mwasq).^2;
    oldssq = sum(mwasq(:));
    %disp(sprintf('SSQ at xstar is %g',oldssq))
  else
    % Save the last estimates of the loads
    oldx0 = x0;
  end
end

% Plot the loadings
if plots ~= 0
  h1 = figure('position',[170 130 512 384],'name','PARAFAC Loadings');
  for i = 1:order
    subplot(order,1,i)
    if ~isempty(scl{i})
      if mwasize(i) <= 50
        plot(scl{i},x0{i},'-+')
      else
         plot(scl{i},x0{i},'-')
      end
    else
      if mwasize(i) <= 50
        plot(x0{i},'-+')
      else
        plot(x0{i},'-')
      end
    end
    ylabel(sprintf('Dimension %g',i))
    if i == 1
      title('Loadings for Each Dimension')
    end
  end
end

% Calculate and plot the residuals  
dif = (mwa-outerm(x0)).^2;
res = cell(1,order);
for i = 1:order
  x = dif;
  for j = 1:order
    if i ~= j
      x = sum(x,j);
    end
  end
  x = squeeze(x);
  res{i} = x(:);
  if plots ~= 0
    if i == 1  
      figure('position',[145 166 512 384],'name','PARAFAC Residuals')
    end
    subplot(order,1,i)
    if ~isempty(scl{i})
      if mwasize(i) <= 50
        plot(scl{i},res{i},'-+')
      else
        plot(scl{i},res{i},'-')
      end
    else
      if mwasize(i) <= 50
        plot(res{i},'-+')
      else
        plot(res{i},'-')
      end
    end
    ylabel(sprintf('Dimension %g',i))
    if i == 1
      title('Residuals for Each Dimension')
    end
  end
end

% Bring the loads back to the front
if plots ~= 0
  figure(h1)
end

% Save the model as a structured array    
model = struct('xname',inputname(1),'name','PARAFAC','date',date,'time',clock,...
  'size',mwasize,'nocomp',nocomp,'tol',tol,'final',[relchange abschange iter]);
model.ssq = [tssq ssq];
model.loads = x0;
model.res = res;
model.scl = scl;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人av综合在线| 久久久久国产精品免费免费搜索| 不卡的电影网站| 国产九色sp调教91| 精品无人区卡一卡二卡三乱码免费卡| 丝袜亚洲另类欧美综合| 亚洲国产精品久久人人爱蜜臀 | 亚洲一区免费在线观看| 伊人性伊人情综合网| 一个色综合av| 午夜成人免费电影| 日本人妖一区二区| 九九视频精品免费| 国产成人精品三级| 成人av资源下载| 色老头久久综合| 在线免费亚洲电影| 678五月天丁香亚洲综合网| 91精品蜜臀在线一区尤物| 日韩视频国产视频| 久久久久一区二区三区四区| 久久精品在线观看| 综合在线观看色| 亚洲综合无码一区二区| 免费成人在线视频观看| 国产精品亚洲人在线观看| eeuss鲁一区二区三区| 在线日韩国产精品| 日韩视频在线你懂得| 久久精品亚洲乱码伦伦中文| 最新热久久免费视频| 亚洲成人免费视频| 韩国精品一区二区| 99视频在线观看一区三区| 欧美日韩国产另类不卡| 久久精品日产第一区二区三区高清版 | 欧美日韩国产另类一区| 久久夜色精品一区| 一区二区三区日韩欧美精品| 日本色综合中文字幕| 懂色av一区二区三区蜜臀 | 久久免费精品国产久精品久久久久| 中文在线一区二区| 五月天亚洲婷婷| 国产精品亚洲成人| 欧美日韩视频不卡| 国产色综合久久| 亚洲成人综合网站| 国产aⅴ精品一区二区三区色成熟| 色噜噜夜夜夜综合网| 日韩美女在线视频| 亚洲欧美欧美一区二区三区| 久久精品国产亚洲aⅴ| 91视频xxxx| 精品国产乱码91久久久久久网站| 亚洲天堂网中文字| 狠狠v欧美v日韩v亚洲ⅴ| 在线视频你懂得一区| 国产欧美一区二区在线| 五月婷婷色综合| av激情综合网| 久久精品欧美一区二区三区不卡 | 久久精品久久99精品久久| av一本久道久久综合久久鬼色| 日韩午夜激情电影| 亚洲午夜三级在线| eeuss鲁片一区二区三区在线看| 欧美成人午夜电影| 亚洲第一会所有码转帖| 成人av小说网| 精品福利一二区| 爽爽淫人综合网网站| 93久久精品日日躁夜夜躁欧美| 精品日韩一区二区| 日韩制服丝袜av| 在线观看欧美精品| 中文字幕在线不卡| 国产传媒久久文化传媒| 日韩欧美一级片| 五月激情综合网| 色狠狠一区二区三区香蕉| 中文字幕乱码亚洲精品一区| 国产乱码精品一区二区三| 日韩一级片网站| 亚洲成av人片观看| 色婷婷综合中文久久一本| 国产精品午夜在线观看| 国产乱对白刺激视频不卡| 欧美一级高清片| 日本vs亚洲vs韩国一区三区二区| 欧美亚洲禁片免费| 亚洲美女区一区| 97se亚洲国产综合自在线不卡| 国产精品久久久久久久久免费丝袜 | 欧美精品一区在线观看| 日本不卡免费在线视频| 4438x亚洲最大成人网| 午夜欧美视频在线观看| 欧美日韩一区二区三区四区 | 日韩成人av影视| 欧美一区二区三区视频在线 | 99久久久久免费精品国产| 欧美国产丝袜视频| 成人少妇影院yyyy| 国产精品久久久久一区| a级精品国产片在线观看| 国产精品久久久久久久久搜平片| 成人动漫中文字幕| 亚洲视频一区在线| 色婷婷av一区二区三区之一色屋| 亚洲美女在线国产| 欧美日韩欧美一区二区| 日韩电影在线免费| 精品久久五月天| 国产盗摄精品一区二区三区在线| 中文在线资源观看网站视频免费不卡| 成人av高清在线| 亚洲精品国久久99热| 欧美日韩www| 精品一区二区三区在线播放视频| 2024国产精品| 91亚洲精品久久久蜜桃网站| 一区二区欧美视频| 这里是久久伊人| 国产精品亚洲专一区二区三区| ...xxx性欧美| 56国语精品自产拍在线观看| 久久99国产精品免费| 国产欧美一区在线| 欧美午夜精品久久久久久孕妇| 日韩精品国产精品| 久久久精品欧美丰满| 91原创在线视频| 天天操天天色综合| 久久中文娱乐网| 91激情在线视频| 久久激情综合网| 国产精品久久久久aaaa樱花| 欧美性感一区二区三区| 久久精品国产亚洲一区二区三区 | 国产91精品在线观看| 一区二区三区蜜桃| 欧美精品一区二区三区蜜桃视频 | 久久新电视剧免费观看| 色综合中文字幕国产 | 国产丝袜欧美中文另类| 91精品福利视频| 黑人巨大精品欧美一区| 亚洲男人天堂av网| 日韩欧美国产高清| 99re热视频精品| 久久se精品一区精品二区| 综合久久久久综合| 日韩欧美在线不卡| 91麻豆免费看| 久久精品国产999大香线蕉| 综合久久国产九一剧情麻豆| 日韩免费观看2025年上映的电影 | 欧美人xxxx| 成人动漫在线一区| 麻豆freexxxx性91精品| 亚洲乱码中文字幕| 国产亚洲欧美日韩日本| 欧美日韩久久一区二区| 成人免费观看男女羞羞视频| 视频在线观看一区| 亚洲欧美在线aaa| 精品国产123| 9191成人精品久久| 一本色道久久综合亚洲91 | 日韩午夜在线影院| 色天天综合久久久久综合片| 国产精品一级片在线观看| 视频在线在亚洲| 一区二区三区免费看视频| 中文在线免费一区三区高中清不卡| 日韩欧美成人一区二区| 欧美日韩视频在线观看一区二区三区| 成人av在线一区二区| 国产一区二区三区综合| 日韩精品电影在线观看| 亚洲综合激情网| 亚洲色图欧洲色图| 中文字幕第一区| 国产偷v国产偷v亚洲高清| 欧美精品一区二区三区蜜桃| 日韩亚洲欧美综合| 欧美巨大另类极品videosbest| 色综合久久久久久久久| 成人激情小说网站| 国产精品一区二区不卡| 精品一区二区三区的国产在线播放 | 美女在线一区二区| 丝袜美腿高跟呻吟高潮一区| 亚洲国产综合在线| 亚洲狠狠爱一区二区三区| 亚洲综合色婷婷| 亚洲一区二区三区四区在线免费观看 | aa级大片欧美| 成人教育av在线|