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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? nnrarmx1.m

?? matlab實(shí)現(xiàn)神經(jīng)網(wǎng)絡(luò)程序集合
?? M
字號(hào):
function [W1,W2,Chat,PI_vector,iteration]=nnrarmx1(NetDef,NN,W1,W2,Chat,...
                                                              trparms,method,Y,U)
%  NNARMAX1
%  --------
%          Determines a nonlinear ARMAX model of a dynamic system by training
%          a two layer neural network with a recursive Gauss-Newton method.
%          The function can handle multi-input systems (MISO). It is assumed
%          that the noise can be filtered by a linear MA-filter:
%          y(t)=f(Y(t-1),U(t-1)) + Ce(t)
%
%  CALL:
%   [W1,W2,Chat,critvec,iteration]=...
%                            nnrarmx1(NetDef,NN,W1,W2,Chat,trparms,method,Y,U)
%
%  INPUTS:
%  U       : Input signal (= control signal) (left out in the nnarma case)
%            dim(U) = [(inputs) * (# of data)]
%  Y       : Output signal. dim(Y) = [1 * # of data]
%  NN      : NN=[na nb nc nk].
%            na = # of past outputs used for determining the prediction
%            nb = # of past inputs
%            nc = # of past residuals (= order of C)
%            nk = time delay (usually 1)
%            For multi-input systems, nb and nk contain as many columns as
%            there are inputs.
%  W1,W2   : Input-to-hidden layer and hidden-to-output layer weights.
%            If they are passed as [], they are initialized automatically.
%  Chat    : Initial MA-filter estimate (Automatically initialized if Chat=[])
%  trparms : Contains parameters associated with the training (see RPE)
%  method  : Training (=estimation) method (ff, ct, efra)     
%
%           For time series (NNARMA models), NN=[na nc] only.
% 
%
%  NB NB NB! 
%  --------- 
%  See the function RPE for an explanation of the remaining inputs
%  as well as of the returned variables.
%                                                                        
%  Programmed by : Magnus Norgaard, IAU/IMM, Technical University of Denmark
%  LastEditDate  : July 17, 1996

% >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>   INITIALIZATIONS   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<   
Ndat = length(Y);
na = NN(1);
if length(NN)==2                        % nnarma model
  nc     = NN(2);
  nb     = 0;
  nk     = 0;
  nu     = 0;
else                                    % nnarmax model
  [nu,Ndat]= size(U); 
  nb     = NN(2:1+nu);
  nc     = NN(2+nu);
  nk     = NN(2+nu+1:2+2*nu);
end
nmax     = max([na,nb+nk-1,nc]);        % 'Oldest' signal used as input to the model
N        = Ndat - nmax;                 % Size of training set
nab      = na+sum(nb);                  % na+nb
nabc     = nab+nc;                      % na+nb+nc
hidden   = length(NetDef(1,:));         % Number of hidden neurons
inputs   = nab;                         % Number of inputs to the network
outputs  = 1;                           % Only one output 
L_hidden = find(NetDef(1,:)=='L')';     % Location of linear hidden neurons
H_hidden = find(NetDef(1,:)=='H')';     % Location of tanh hidden neurons
L_output = find(NetDef(2,:)=='L')';     % Location of linear output neurons
H_output = find(NetDef(2,:)=='H')';     % Location of tanh output neurons
PI_vector= [];                          % Vector containing the accumulated SSE
y1       = zeros(hidden,1);             % Hidden layer outputs
y2       = zeros(outputs,1);            % Network output
Eold     = zeros(nc,outputs);           % The nc past residuals
index = outputs*(hidden+1) + 1 + [0:hidden-1]*(inputs+1); % A useful vector!
parameters1= hidden*(inputs+1);         % # of input-to-hidden weights
parameters2= outputs*(hidden+1);        % # of hidden-to-output weights
parameters12=parameters1 + parameters2; % Total # of weights
parameters = parameters12 + nc;         % Total # of parameters
PSI        = zeros(parameters,outputs); % Deriv. of each output w.r.t. each weight
RHO        = zeros(parameters12,outputs);% Partial -"-  -"-
RHO2       = zeros(nc,outputs);         % Partial deriv. of output wrt. each C-par.

if isempty(W1) | isempty(W2),           % Initialize weights if nescessary
  if nb==0,
    [W1,W2]=nnarx(NetDef,na,[],[],[200 0 1 0],Y);
  else
    [W1,W2]=nnarx(NetDef,[na nb nk],[],[],[200 0 1 0],Y,U);
  end                            
end
if isempty(Chat),                       % Initialize a stable Chat if nescessary
  while sum(abs(roots(Chat))<1)<nc
    Chat = [1 rand(1,nc)-0.5];
  end
end                                     % Parametervector containing all weights
theta = [reshape(W2',parameters2,1) ; reshape(W1',parameters1,1); Chat(2:nc+1)'];
theta_index = find(theta);              % Index to weights<>0
theta_red = theta(theta_index);         % Reduced parameter vector
reduced  = length(theta_index);         % The # of parameters in theta_red
index3 = 1:(reduced+1):(reduced^2);     % Yet another useful vector
PSIold = zeros(reduced,nc);             % Past PSI vectors
max_iter = trparms(1);                  % Max. # of iterations 
stop_crit= trparms(2);                  % Stop criterion
if strcmp(method,'ff'),                 % Forgetting factor method
  mflag     = 1;                        % Method flag
  lambda    = trparms(4);               % Forgetting factor
  p0        = trparms(3);
  P         = p0 * eye(reduced);        % Initialize covariance matrix
elseif strcmp(method,'ct'),             % Constant trace method
  mflag     = 2;                        % Method flag
  alpha_max = trparms(3);               % Max. eigenvalue
  alpha_min = trparms(4);               % Min. eigenvalue
  P      = alpha_max * eye(reduced);    % Initialize covariance matrix
elseif strcmp(method,'efra'),           % EFRA method
  mflag     = 3;                        % Method flag
  alpha     = trparms(3);               % EFRA parameters
  beta      = trparms(4);
  delta     = trparms(5);
  lambda    = trparms(6);
  gamma     = (1-lambda)/lambda;
                                        % Max. eigenvalue
  maxeig = gamma/(2*delta)*(1+sqrt(1+4*beta*delta/(gamma*gamma)));
  P      = maxeig * eye(reduced);       % Initialize covariance matrix
  betaI     = beta*eye(reduced);        % Useful diagonal matrix
end
I        = eye(outputs);                % (outputs|outputs) unity matrix
lambdaI  = lambda*I;                    % Diagonal matrix


% >>>>>>>>>>>>>>>>>>>>  CONSTRUCT THE REGRESSION MATRIX PHI   <<<<<<<<<<<<<<<<<<<<<
PHI = zeros(nab,N);
jj  = nmax+1:Ndat;
for k = 1:na, PHI(k,:)    = Y(jj-k); end
index5 = na;
for kk = 1:nu,
  for k = 1:nb(kk), PHI(k+index5,:) = U(kk,jj-k-nk(kk)+1); end
  index5 = index5 + nb(kk);
end
PHI_aug  = [PHI;ones(1,N)];             % Augment PHI with a row containg ones
Y        = Y(nmax+1:Ndat);              % Extract the 'target' part of Y



%----------------------------------------------------------------------------------
%-------------                    TRAIN NETWORK                       -------------
%----------------------------------------------------------------------------------
clc;
c=fix(clock);
fprintf('Network training started at %2i.%2i.%2i\n\n',c(4),c(5),c(6));

for iteration=1:max_iter,
  SSE=0;
  for t=1:N,

% >>>>>>>>>>>>>>>>>>>>>>>>  COMPUTE NETWORK OUTPUT y2(theta) <<<<<<<<<<<<<<<<<<<<<<
    h1 = W1(:,1:inputs)*PHI(:,t) + W1(:,inputs+1);  
    y1(H_hidden) = pmntanh(h1(H_hidden)); 
    y1(L_hidden) = h1(L_hidden);
    
    h2 = W2(:,1:hidden)*y1 + W2(:,hidden+1);
    y2(H_output) = pmntanh(h2(H_output));
    y2(L_output) = h2(L_output);

    y1_aug = [y1;1];
    E   = Y(:,t) - y2 - Chat(2:nc+1)*Eold;


%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  COMPUTE THE RHO MATRIX  <<<<<<<<<<<<<<<<<<<<<<<<<<<
% Partial derivative of output (y2) with respect to each weight and neglecting
% that the model inputs (the residuals) depends on the weights

    % ==========   Elements corresponding to the linear output units   ============
    for i = L_output'
      % -- The part of RHO corresponding to hidden-to-output layer weights --
      index1 = (i-1) * (hidden + 1) + 1;
      RHO(index1:index1+hidden,i) = y1_aug;
      % ---------------------------------------------------------------------
 
      % -- The part of RHO corresponding to input-to-hidden layer weights ---
      for j = L_hidden',
        RHO(index(j):index(j)+inputs,i) = W2(i,j)*PHI_aug(:,t);
      end
      
      for j = H_hidden',
        RHO(index(j):index(j)+inputs,i) = W2(i,j)*(1-y1(j)*y1(j))*PHI_aug(:,t);
      end 
      % ---------------------------------------------------------------------    
    end

    % ============  Elements corresponding to the tanh output units   =============
    for i = H_output',
      % -- The part of RHO corresponding to hidden-to-output layer weights --
      index1 = (i-1) * (hidden + 1) + 1;
      RHO(index1:index1+hidden,i) = y1_aug * (1 - y2(i)*y2(i));
      % ---------------------------------------------------------------------
       
      % -- The part of RHO corresponding to input-to-hidden layer weights ---
      for j = L_hidden',
        RHO(index(j):index(j)+inputs,i) = W2(i,j)*(1-y2(i)*y2(i))...
                                                              * PHI_aug(:,t);
      end
      
      for j = H_hidden',
        RHO(index(j):index(j)+inputs,i) = W2(i,j)*(1-y1(j)*y1(j))...
                                             *(1-y2(i)*y2(i)) * PHI_aug(:,t);
      end
      % ---------------------------------------------------------------------
    end
    RHO_red = [RHO(theta_index(1:reduced-nc));Eold];



% >>>>>>>>>>>>>>>>>>>>>>>>>>>   COMPUTE THE PSI MATRIX   <<<<<<<<<<<<<<<<<<<<<<<<<<
  PSI_red=RHO_red;
  for i=1:nc,
    PSI_red = PSI_red-Chat(i+1)*PSIold(:,i);
  end


  
%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>    UPDATE THE WEIGHTS    <<<<<<<<<<<<<<<<<<<<<<<<<<<
    
    % ---------- Forgetting factor method ----------
    if mflag == 1,
      % -- Update P matrix --
      P = (P - P*PSI_red*inv(lambdaI + PSI_red'*P*PSI_red)*PSI_red'*P ) / lambda;

      % -- Update Parameters --
      theta_red = theta_red + P*PSI_red*E;
      
    % ----------  Constant trace method   ---------- 
    elseif mflag == 2,
      % -- Measurement update of P matrix --
      P = (P - P*PSI_red * inv(I + PSI_red'*P*PSI_red) * PSI_red'*P );

      % -- Update Parameters --
      theta_red = theta_red + P*PSI_red*E;

      % -- Time update of P matrix --
      P         = ((alpha_max-alpha_min)/trace(P))*P;
      P(index3) = P(index3)+alpha_min;
      
    % ----------       EFRA method        ---------- 
    else 
      % -- Correction factor --
      K = P*PSI_red * (alpha*inv(I + PSI_red'*P*PSI_red));

      % -- Update Parameters --
      theta_red = theta_red + K*E;
      
      % -- Update P --
      P = P/lambda - K*PSI_red'*P + betaI-delta*P*P;
    end
    theta(theta_index) = theta_red;       % Put estimated weights back into theta


    % -- Put the parameters back into the weight matrices and Chat--
    W1   = reshape(theta(parameters2+1:parameters12),inputs+1,hidden)';
    W2   = reshape(theta(1:parameters2),hidden+1,outputs)';
    Chat = [1 theta(parameters12+1:parameters)'];

 
    % -- Accumulate SSE --
    SSE = SSE + E'*E;
  end

  
%>>>>>>>>>>>>>>>>>>>>>>       UPDATES FOR NEXT ITERATION       <<<<<<<<<<<<<<<<<<<<
  % ---- Make sure the roots of C are located inside the unit circle --
  croots = roots(Chat);
  for i=1:length(croots),
    if abs(croots(i))>1, croots(i)=1/croots(i); end
  end
  Chat=real(poly(croots));
  theta(reduced-nc+1:reduced)=Chat(2:nc+1)';

  PI = SSE/(2*N);
  PI_vector(iteration) = PI;            % Collect PI
  Eold = [E;Eold(1:nc-1)];              % Past residuals
  PSIold = [PSI_red,PSIold(:,1:nc-1)];  % Past gradients

  fprintf('iteration # %i   PI = %4.3e\r',iteration,PI); % Print on-line inform.
  if PI < stop_crit, break, end         % Check if stop condition is fulfilled
end


%----------------------------------------------------------------------------------
%-------------              END OF NETWORK TRAINING                  --------------
%----------------------------------------------------------------------------------
c=fix(clock);
fprintf('\n\nNetwork training ended at %2i.%2i.%2i\n',c(4),c(5),c(6));




?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久99久久精品| 人妖欧美一区二区| 亚洲一二三级电影| 免费人成在线不卡| 成人美女视频在线观看18| 欧美日韩综合在线免费观看| 日韩欧美区一区二| 亚洲三级免费观看| 美女诱惑一区二区| zzijzzij亚洲日本少妇熟睡| 6080午夜不卡| 久久九九全国免费| 亚洲成人免费电影| 国产激情视频一区二区三区欧美 | 在线免费一区三区| 日韩丝袜情趣美女图片| 中文字幕av资源一区| 五月综合激情日本mⅴ| 成人中文字幕电影| 欧美猛男男办公室激情| 欧美国产一区二区在线观看 | 日韩欧美国产1| 国产精品理论片| 麻豆精品新av中文字幕| 91视视频在线直接观看在线看网页在线看| 911精品国产一区二区在线| 欧美极品另类videosde| 免费人成精品欧美精品| 日本精品一级二级| 久久久精品免费网站| 日韩黄色片在线观看| 97se狠狠狠综合亚洲狠狠| 日韩一区二区三区四区| 亚洲欧美成aⅴ人在线观看| 国产伦精一区二区三区| 91.成人天堂一区| 亚洲欧美日韩综合aⅴ视频| 久久91精品国产91久久小草| 欧美三级一区二区| 国产精品福利一区| 国产高清精品网站| 欧美一级片免费看| 亚洲第一狼人社区| 91视频免费播放| 国产欧美一区二区精品婷婷| 另类成人小视频在线| 欧美色图在线观看| 亚洲精品乱码久久久久久久久| 国产精品亚洲专一区二区三区 | 青草av.久久免费一区| 日本久久精品电影| 国产精品第13页| 丁香激情综合国产| 久久这里只有精品首页| 蜜桃av一区二区三区| 欧美一级精品大片| 天堂成人免费av电影一区| 一本一道综合狠狠老| 亚洲人一二三区| av成人免费在线| 18成人在线观看| av不卡一区二区三区| 中文字幕视频一区二区三区久| 国产大片一区二区| 国产欧美va欧美不卡在线| 国产在线播放一区二区三区| 精品av久久707| 久久97超碰国产精品超碰| 精品捆绑美女sm三区| 久久精品国产99久久6| 精品国产免费视频| 精品在线免费视频| 久久色.com| 国产精品亚洲第一区在线暖暖韩国| 久久噜噜亚洲综合| 国产精品一区二区三区网站| 国产欧美日韩麻豆91| 粉嫩av一区二区三区在线播放| 国产欧美日韩综合精品一区二区| 国产精品一级片| 中文字幕一区二区三| 一本大道久久a久久综合| 亚洲激情图片小说视频| 欧美日韩dvd在线观看| 麻豆一区二区在线| 久久久亚洲精华液精华液精华液| 高清成人免费视频| 亚洲人成小说网站色在线| 欧美午夜免费电影| 免费观看在线综合| 久久精品人人做人人综合| 成人教育av在线| 亚洲主播在线播放| 日韩一区二区三区免费观看| 国内精品国产三级国产a久久| 国产欧美日韩麻豆91| 色婷婷一区二区三区四区| 香蕉av福利精品导航| 精品国产乱码久久久久久老虎 | 亚洲欧美激情一区二区| 91.com视频| 国产成人av影院| 一区二区三区欧美亚洲| 欧美一区二区三区视频在线观看| 国产综合色视频| 亚洲欧美电影院| 欧美一区二区三区日韩视频| 国产精品一区二区三区四区| 亚洲色图欧洲色图婷婷| 69堂精品视频| 成人免费va视频| 日本中文字幕一区二区视频 | 91蜜桃免费观看视频| 五月婷婷欧美视频| 久久精品日韩一区二区三区| 在线日韩av片| 国产精品一区三区| 亚洲国产一区二区视频| 久久亚洲二区三区| 精品视频在线免费观看| 国产一区二区按摩在线观看| 一区二区视频在线| 精品国产一区二区三区久久影院| 91美女视频网站| 男男视频亚洲欧美| 亚洲乱码国产乱码精品精小说 | 国产高清不卡二三区| 亚洲免费在线观看视频| 欧美成va人片在线观看| 在线观看av一区二区| 国产精品综合在线视频| 午夜精品福利视频网站| 中文字幕一区二区三区蜜月| 日韩美女视频一区二区在线观看| 91极品视觉盛宴| 国产成人精品三级| 美女任你摸久久| 亚洲一区二区三区不卡国产欧美| 久久久久久久av麻豆果冻| 欧美猛男男办公室激情| 99久久精品免费观看| 精品一区二区三区的国产在线播放 | 五月天欧美精品| 中文字幕一区二区三区蜜月| 欧美xxx久久| 欧美人狂配大交3d怪物一区| 99re热视频精品| 国产精品一级二级三级| 蜜桃视频在线观看一区| 亚洲国产精品精华液网站 | 91视频xxxx| 国产一区二区免费视频| 美女在线一区二区| 五月天亚洲婷婷| 亚洲一区二区av在线| 亚洲色图19p| 国产精品天干天干在线综合| 精品久久国产字幕高潮| 日韩三级电影网址| 欧美日韩免费电影| 欧美影视一区在线| 91美女片黄在线观看91美女| 国产成人精品三级| 国产精品一区在线观看乱码| 久久国内精品自在自线400部| 日本在线不卡视频| 亚洲第一狼人社区| 亚洲国产精品一区二区久久| 一区二区在线看| 亚洲色图视频网站| 亚洲欧洲国产专区| 中文字幕中文在线不卡住| 中文字幕成人网| 国产精品久久久久久久久图文区 | 成人va在线观看| 国产成人自拍在线| 狠狠色丁香婷婷综合| 韩国av一区二区三区在线观看| 老司机精品视频导航| 美女一区二区三区在线观看| 日韩电影在线一区二区| 日本sm残虐另类| 精品综合免费视频观看| 国产乱国产乱300精品| 国产经典欧美精品| av在线一区二区| 色呦呦日韩精品| 在线视频欧美精品| 欧美无人高清视频在线观看| 欧美老人xxxx18| 日韩欧美国产一二三区| 久久久久久久一区| 国产精品传媒在线| 亚洲精品国产无套在线观| 亚洲综合免费观看高清在线观看| 亚洲国产精品一区二区久久恐怖片| 日本中文字幕一区二区视频 | 欧美国产亚洲另类动漫| 成人欧美一区二区三区小说| 亚洲一卡二卡三卡四卡|