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

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

?? nnd16lv1.m

?? 《神經(jīng)網(wǎng)絡(luò)設(shè)計》英文版的配套源代碼
?? M
字號:
function nnd16lv1(cmd,arg1,arg2,arg3)
%NND4LV1 LVQ1 demonstration.
%
%  This demonstration requires the Neural Network Toolbox.

% $Revision: 1.7 $
% Copyright 1994-2002 PWS Publishing Company and The MathWorks, Inc.
% First Version, 8-31-95.

%==================================================================

% CONSTANTS
me = 'nnd16lv1';
p_max = 3;
max_epoch = 5;
W2 = [1 1 0 0;
      0 0 1 1];
box_x = [-1 1 1 -1 -1]*0.1;
box_y = [-1 -1 1 1 -1]*0.1;
cross_x = [-1 1 NaN 0 0]*0.15;
cross_y = [0 0 NaN -1 1]*0.15;
lr = 0.6;
center_colors = [nnblack;nnltblue];

% FLAGS
change_func = 0;

% DEFAULTS
if nargin == 0, cmd = ''; else cmd = lower(cmd); end

% FIND WINDOW IF IT EXISTS
fig = nndfgflg(me);
if length(get(fig,'children')) == 0, fig = 0; end
  
% GET WINDOW DATA IF IT EXISTS
if fig
  H = get(fig,'userdata');
  fig_axis = H(1);            % window axis
  desc_text = H(2);           % handle to first line of text sequence
  v_axis = H(3);              % training and weight vector axis
  t1_axis = H(4);             % black target marker axis
  t2_axis = H(5);             % white target marker axis
  W1_ptr = H(6);
  P_ptr = H(7);
  T_ptr = H(8);
  PV_ptr = H(9);
  t_ptr = H(10);
  WV_ptr = H(11);
  blip_ptr = H(12);
  bloop_ptr = H(13);
end

%==================================================================
% Activate the window.
%
% ME() or ME('')
%==================================================================

if strcmp(cmd,'')
  if fig
    figure(fig)
    set(fig,'visible','on')
  else
    feval(me,'init')
  end

%==================================================================
% Close the window.
%
% ME() or ME('')
%==================================================================

elseif strcmp(cmd,'close') & (fig)
  delete(fig)

%==================================================================
% Initialize the window.
%
% ME('init')
%==================================================================

elseif strcmp(cmd,'init') & (~fig)

  % CHECK FOR NNT
  % ODJ 12/23/07 Check for NN Toolbox removed
  %if ~nntexist(me), return, end

  % CONSTANTS
  W1 = 2*rand(4,2)-1; %rands(4,2);
  P = [-1.5  -2.0 2.0  1.5  2.0  2.0 -2.0 -1.5;
        2.0   1.5 2.0  2.0 -2.0 -1.5 -2.0 -2.0];
  T = [  1    1    0    0    1    1    0    0;
         0    0    1    1    0    0    1    1];
  A1 = compet(-dist(W1,P));
  A2 = W2*A1;
  E = T-A2;
  blip = nndsnd(6);
  bloop = nndsnd(7);

  % NEW DEMO FIGURE
  fig = nndemof2(me,'DESIGN','LVQ1','','Chapter 16');
  set(fig, ...
    'windowbuttondownfcn',nncallbk(me,'down'), ...
    'BackingStore','off',...
    'nextplot','add');
  H = get(fig,'userdata');
  fig_axis = H(1);
  desc_text = H(2);

  % ICON
  nndicon(16,458,363,'shadow')

  % VECTOR DIAGRAM
  v_axis = nnsfo('a2','','','');
  set(v_axis,...
    'position',[50 60 270*1.05 270*1.05],...
    'xlim',[-p_max p_max]*1.05,...
    'xtick',[],...
    'ylim',[-p_max p_max]*1.05,...
    'ytick',[])

  % INPUT VECTOR MARKERS
  cross = plot([-p_max p_max NaN 0 0],[0 0 NaN -p_max p_max],':',...
    'color',nndkblue,...
    'erasemode','none');
  Q = size(P,2);
  PV = zeros(1,Q);
  for q=1:Q
    if E(1,q)
      edge_color = nnred;
    else
      edge_color = nndkgray;
    end
    PV(q) = fill(box_x+P(1,q),box_y+P(2,q),center_colors(1+T(1,q),:),...
      'edgecolor',edge_color,...
      'erasemode','none',...
      'linewidth',2);
  end

  % WEIGHT MARKERS
  S1 = size(W1,1);
  for i=S1:-1:1
    WV(i) = plot(cross_x+W1(i,1),cross_y+W1(i,2),...
      'color',center_colors(1+W2(1,i),:),...
      'linewidth',3,...
      'erasemode','none');
  end

  % NEW INPUT MARKERS
  t1_axis = nnsfo('a2','','','');
  set(t1_axis,...
    'position',[50 20 20*1.05 20*1.05],...
    'xlim',[-.16 .16],...
    'ylim',[-.16 .16])
  axis('off')
  fill(box_x,box_y,nnltblue,...
    'edgecolor',nndkgray,...
      'linewidth',2)
  t2_axis = nnsfo('a2','','','');
  set(t2_axis,...
    'position',[70 20 20*1.05 20*1.05],...
    'xlim',[-.16 .16],...
    'ylim',[-.16 .16])
  axis('off')
  fill(box_x,box_y,[0 0 0],...
    'edgecolor',nndkgray,...
    'linewidth',2)

  % BUTTONS
  uicontrol(...
    'units','points',...
    'position',[110 20 60 20],...
    'string','Learn',...
    'callback',[me '(''learn'')'])
  uicontrol(...
    'units','points',...
    'position',[190 20 60 20],...
    'string','Train',...
    'callback',[me '(''train'')'])
  uicontrol(...
    'units','points',...
    'position',[270 20 60 20],...
    'string','Random',...
    'callback',[me '(''random'')'])

  uicontrol(...
    'units','points',...
    'position',[400 110 60 20],...
    'string','Contents',...
    'callback','nndtoc')
  uicontrol(...
    'units','points',...
    'position',[400 75 60 20],...
    'string','Close',...
    'callback',[me '(''close'')'])

  % DATA POINTERS
  W1_ptr = uicontrol('visible','off','userdata',W1);
  P_ptr = uicontrol('visible','off','userdata',P);
  T_ptr = uicontrol('visible','off','userdata',T);
  PV_ptr = uicontrol('visible','off','userdata',PV);
  t_ptr = uicontrol('visible','off','userdata',[0;0]);
  WV_ptr = uicontrol('visible','off','userdata',WV);
  blip_ptr = uicontrol('visible','off','userdata',blip);
  bloop_ptr = uicontrol('visible','off','userdata',bloop);

  % SAVE WINDOW DATA AND LOCK
  H = [fig_axis desc_text v_axis t1_axis t2_axis,...
       W1_ptr P_ptr T_ptr PV_ptr t_ptr WV_ptr blip_ptr bloop_ptr];
  set(fig,'userdata',H,'nextplot','new')

  % INSTRUCTION TEXT
  feval(me,'instr');

  % LOCK WINDOW
  set(fig,...
   'nextplot','new',...
   'color',nnltgray);

  nnchkfs;

%==================================================================
% Display the instructions.
%
% ME('instr')
%==================================================================

elseif strcmp(cmd,'instr') & (fig)
  nnsettxt(desc_text,...
    'Click [Learn] to apply',...
    'the LVQ1 rule once.',...
    'Click [Train] to apply',...
    'the rule 5 times.',...
    'Click [Random] to get',...
    'random weights.',...
    '',...
    'Drag the blue and',...
    'black squares to define',...
    'different problems.',...
    '',...
    'Colors of crosses (wts)',...
    'and inside squares',...
    'indicate class. Red',...
    'edge indicates a',...
    'misclassified vector.')
    
%==================================================================
% Respond to mouse down.
%
% ME('down')
%==================================================================

elseif strcmp(cmd,'down') & (fig) & (nargin == 1)

  pt = get(v_axis,'currentpoint');
  x = pt(1);
  y = pt(3);

  % EDIT VECTOR AXIS
  if (x >= -p_max) & (x <= p_max) & (y >= -p_max) & (y <= p_max)

    % EDIT INPUT/TARGET DOT
    P = get(P_ptr,'userdata');
    T = get(T_ptr,'userdata');
    PV = get(PV_ptr,'userdata');
    WV = get(WV_ptr,'userdata');

    Q = size(P,2);
    for q=1:Q

      if sqrt(sum((P(:,q)-[x; y]).^2)) < 0.15
        t = T(:,q);        
        set(PV(q),...
          'facecolor',nnltyell,...
          'edgecolor',nnltyell);
        delete(PV(q));
        P(:,q) = [];
        T(:,q) = [];
        PV(:,q) = [];

        set(fig,...
         'pointer','cross',...
         'WindowButtonUpFcn',[me '(''setdot'')'])

        set(P_ptr,'userdata',P);
        set(T_ptr,'userdata',T);
        set(PV_ptr,'userdata',PV);
        set(t_ptr,'userdata',t);

        set(WV,'visible','off')
        for i=length(WV):-1:1
          set(WV(i),'visible','on')
        end
        break;
      end
    end
  
  % NEW SQUARE
  else
    pt = get(t1_axis,'currentpoint');
    x = pt(1);
    y = pt(3);

    % BLACK SQUARE
    if (x >= -.15) & (x <= .15) & (y >= -.15) & (y <= .15)
       set(fig,...
       'pointer','circle',...
       'WindowButtonUpFcn',[me '(''setdot'')'])
      set(t_ptr,'userdata',[1;0]);
    
    else
      pt = get(t2_axis,'currentpoint');
      x = pt(1);
      y = pt(3);

      % WHITE SQUARE
      if (x >= -.15) & (x <= .15) & (y >= -.15) & (y <= .15)
         set(fig,...
         'pointer','circle',...
         'WindowButtonUpFcn',[me '(''setdot'')'])
        set(t_ptr,'userdata',[0;1]);
      end
    end
  end

%==================================================================
% Set decision dot.
%
% ME('setdot')
%==================================================================

elseif strcmp(cmd,'setdot') & (fig) & (nargin == 1)

  pt = get(v_axis,'currentpoint');
  x = pt(1);
  x = round(x*2)/2;
  y = pt(3);
  y = round(y*2)/2;

  if (x >= -p_max) & (x <= p_max) & (y >= -p_max) & (y <= p_max)
    P = get(P_ptr,'userdata');
    T = get(T_ptr,'userdata');
    W1 = get(W1_ptr,'userdata');
    PV = get(PV_ptr,'userdata');
    t = get(t_ptr,'userdata');
    WV = get(WV_ptr,'userdata');
    
    q = size(PV,2)+1;
    set(fig,'nextplot','add');
    axes(v_axis);

    P = [P [x;y]];
    T = [T t];

    A1 = compet(-dist(W1,P));
    A2 = W2*A1;
    E = T-A2;

    if E(1,q)
      edge_color = nnred;
    else
      edge_color = nndkgray;
    end
    PV(q) = fill(box_x+x,box_y+y,center_colors(1+T(1,q),:),...
      'edgecolor',edge_color,...
      'erasemode','none',...
      'linewidth',2);
    set(fig,'nextplot','new');
  
    set(P_ptr,'userdata',P);
    set(T_ptr,'userdata',T);
    set(PV_ptr,'userdata',PV);

    set(WV,'visible','off')
    for i=length(WV):-1:1
      set(WV(i),'visible','on')
    end
  end

  set(fig,...
    'pointer','arrow',...
    'WindowButtonUpFcn','')
    
%==================================================================
% Learn.
%
% ME('learn')
%==================================================================

elseif strcmp(cmd,'learn')
  
  max_epoch = 1;
  cmd = 'train';

%==================================================================
% Random weights.
%
% ME('random')
%==================================================================

elseif strcmp(cmd,'random')
  
  % GET DATA
  W1 = get(W1_ptr,'userdata');
  WV = get(WV_ptr,'userdata');
  P = get(P_ptr,'userdata');
  T = get(T_ptr,'userdata');
  PV = get(PV_ptr,'userdata');
  blip = get(blip_ptr,'userdata');
  bloop = get(bloop_ptr,'userdata');
  Q = size(P,2);

  % MOVE WEIGHTS
  set(WV,'color',nngreen);
  nnsound(blip);
  nnpause(0.5)
 
  W1 = (rand(4,2)*2-1)*1.25;
  set(WV,'color',nnltyell);
  set(WV,'visible','off');
  for i=length(WV):-1:1
    set(WV(i),...
      'xdata',cross_x + W1(i,1),...
      'ydata',cross_y + W1(i,2),...
      'color',center_colors(1+W2(1,i),:));
    set(WV(i),'visible','on')
    nnsound(bloop);
  end

  % REDRAW INPUT VECTORS
  A1 = compet(-dist(W1,P));
  A2 = W2*A1;
  E = T-A2;
  for q=1:Q
    if E(1,q)
     edge_color = nnred;
    else
      edge_color = nndkgray;
    end
    set(PV(q),...
      'facecolor',center_colors(1+T(1,q),:),...
      'edgecolor',edge_color);
  end

  % REFRESH WEIGHT VECTORS
  set(WV,'visible','off')
  for i=length(WV):-1:1
    set(WV(i),'visible','on')
  end

  % SAVE DATA
  set(W1_ptr,'userdata',W1);

%==================================================================
end

%==================================================================
% Train.
%
% ME('train')
%==================================================================

if strcmp(cmd,'train')
  
  % GET DATA
  W1 = get(W1_ptr,'userdata');
  WV = get(WV_ptr,'userdata');
  P = get(P_ptr,'userdata');
  T = get(T_ptr,'userdata');
  PV = get(PV_ptr,'userdata');
  Q = length(PV);
  if (Q == 0)
    return
  end
  blip = get(blip_ptr,'userdata');
  bloop = get(bloop_ptr,'userdata');
  axes(v_axis)
  set(fig,'nextplot','add')

  for i=1:max_epoch
    
    % GENERATE SOME RANDOM NUMBERS
    rand(1,ceil(rand*5));

    % CHECK ERROR
    A1 = compet(-dist(W1,P));
    A2 = W2*A1;
    E = T-A2;
    if ~any(any(E)) & (max_epoch > 1) & 0, break, end
    
    % PRESENT VECTOR
    q = floor(rand*Q)+1;
    p = P(:,q);
    t = T(:,q);
    a1 = compet(-dist(W1,p));
    a2 = W2*a1;
    e = t-a2;
    set(PV(q),'facecolor',nngreen);
    nnsound(blip);
    nnpause(0.5)

    % MOVE WEIGHT
    i = find(a1);
    if any(e)
      face_color = nnred;
    else
      face_color = nngreen;
    end
    set(WV(i),'color',face_color);
    nnsound(blip);
    nnpause(0.5)
 
    e = W2'*t;
    i = find(a1);
    newW1 = W1;
    [s,r] = size(W1(i,:));
    %newW1(i,:) = W1(i,:) + (e(i)*2-1)*feval('learnis',W1(i,:),p,a1(i),lr);
    newW1(i,:) = W1(i,:) + (e(i)*2-1)*((lr*a1(i)*ones(1,r)) .* (ones(s,1)*p'-W1(i,:)));

    temp = nndrwvec([W1(i,1) newW1(i,1)],[W1(i,2) newW1(i,2)],...
      1,0.2,face_color,'','none');
    nnsound(blip);
    nnpause(1)
    set(temp,'color',nnltyell)
    delete(temp);
    W1 = newW1;

    plotW1 = W1(i,:);
    set(WV(i),'color',nnltyell);
    set(WV(i),'visible','off');
    set(WV(i),...
      'xdata',cross_x + plotW1(1),...
      'ydata',cross_y + plotW1(2),...
      'color',center_colors(1+W2(1,i),:));
    set(WV(i),'visible','on')
    nnsound(bloop);

    % REDRAW INPUT VECTORS
    A1 = compet(-dist(W1,P));
    A2 = W2*A1;
    E = T-A2;
    for q=1:Q
      if E(1,q)
       edge_color = nnred;
      else
        edge_color = nndkgray;
      end
      set(PV(q),...
        'facecolor',center_colors(1+T(1,q),:),...
        'edgecolor',edge_color);
    end
  
    % REFRESH WEIGHT VECTORS
    set(WV,'visible','off')
    for i=length(WV):-1:1
      set(WV(i),'visible','on')
    end
  end
 
  set(W1_ptr,'userdata',W1);
  set(fig,'nextplot','new')
end

function a=compet(n)
[S,Q] = size(n);
[maxn,indn] = max(n,[],1);
a = sparse(indn,1:Q,ones(1,Q),S,Q);

function z = dist(w,p)
[S,R] = size(w);
[R2,Q] = size(p);
if (R ~= R2), error('Inner matrix dimensions do not match.'),end
z = zeros(S,Q);
if (Q<S)
  p = p';
  copies = zeros(1,S);
  for q=1:Q
    z(:,q) = sum((w-p(q+copies,:)).^2,2);
  end
else
  w = w';
  copies = zeros(1,Q);
  for i=1:S
    z(i,:) = sum((w(:,i+copies)-p).^2,1);
  end
end
z = z.^0.5;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一区二区美女| 日韩视频免费直播| 日韩一区在线看| 99国产欧美久久久精品| 亚洲天堂2014| 欧美亚洲一区二区在线| 亚洲影院在线观看| 欧美一级日韩一级| 国产一区二区三区精品欧美日韩一区二区三区 | 日韩二区三区在线观看| 欧美日韩国产成人在线免费| 视频一区在线视频| 26uuuu精品一区二区| 国产传媒欧美日韩成人| 亚洲精品国产第一综合99久久| 欧美日韩一区二区三区四区| 麻豆国产一区二区| 欧美激情中文不卡| 欧美午夜精品免费| 加勒比av一区二区| 国产精品久久夜| 欧美日韩国产不卡| 国产麻豆9l精品三级站| 一区二区三区在线高清| 日韩视频免费观看高清在线视频| 国产福利一区在线| 午夜久久久久久电影| 久久天堂av综合合色蜜桃网| 色哟哟一区二区在线观看| 裸体在线国模精品偷拍| 亚洲色图另类专区| 日韩精品中文字幕一区二区三区| thepron国产精品| 秋霞午夜av一区二区三区| 亚洲欧美综合另类在线卡通| 69精品人人人人| 99视频超级精品| 精品一区二区av| 亚洲综合一二区| 国产精品视频你懂的| 91 com成人网| 一本大道久久a久久精品综合| 韩国中文字幕2020精品| 亚洲永久精品国产| 中文字幕在线一区| 精品国精品国产尤物美女| 欧美丝袜自拍制服另类| 成人影视亚洲图片在线| 久久se精品一区二区| 亚洲综合偷拍欧美一区色| 久久久777精品电影网影网| 欧美日产国产精品| 色视频一区二区| 懂色av一区二区三区蜜臀| 麻豆极品一区二区三区| 亚洲va欧美va国产va天堂影院| 中文字幕在线一区| 国产婷婷精品av在线| 欧美va天堂va视频va在线| 欧美浪妇xxxx高跟鞋交| 在线视频你懂得一区二区三区| 成人午夜电影网站| 国产精品中文字幕一区二区三区| 日韩**一区毛片| 午夜精品视频在线观看| 一区二区三区四区在线播放| 国产精品久久久久久久久免费相片| 精品三级av在线| 欧美v国产在线一区二区三区| 制服.丝袜.亚洲.中文.综合| 欧美日韩视频在线第一区| 91欧美一区二区| 97超碰欧美中文字幕| 97久久精品人人爽人人爽蜜臀 | 美国三级日本三级久久99| 亚洲电影在线免费观看| 亚洲一级二级在线| 亚洲综合图片区| 亚洲激情欧美激情| 亚洲综合精品自拍| 中文字幕一区二区不卡| 国产精品久久毛片a| 国产精品毛片久久久久久| 国产欧美一区二区精品久导航| 精品成人佐山爱一区二区| 精品日韩一区二区| 久久人人97超碰com| 国产清纯在线一区二区www| 国产亚洲精品福利| 日本一区二区三区久久久久久久久不 | 精品国产网站在线观看| 精品久久久久久久久久久院品网| 日韩女优av电影在线观看| 久久亚洲精精品中文字幕早川悠里| 久久久国产精品午夜一区ai换脸| 国产亚洲综合av| 国产精品不卡在线| 亚洲成av人综合在线观看| 日韩电影在线观看电影| 国产一区二区三区精品欧美日韩一区二区三区| 国产在线播放一区三区四| 成人国产精品免费观看视频| www.亚洲人| 欧美日韩视频专区在线播放| 欧美成人r级一区二区三区| 国产精品水嫩水嫩| 亚洲电影一区二区三区| 久久电影网电视剧免费观看| 懂色av噜噜一区二区三区av| 在线一区二区三区四区| 日韩欧美自拍偷拍| 国产精品人妖ts系列视频 | 日韩**一区毛片| 国产麻豆视频一区二区| 色吊一区二区三区| 日韩免费电影网站| 亚洲三级久久久| 蜜桃一区二区三区四区| 99视频有精品| 日韩一区二区电影| 中文字幕日本乱码精品影院| 亚洲成人av免费| 国产成人精品www牛牛影视| 色婷婷av一区二区三区大白胸| 日韩欧美久久久| 亚洲色图在线视频| 激情综合网激情| 日本韩国欧美在线| 久久久久久97三级| 婷婷国产v国产偷v亚洲高清| 成人伦理片在线| 日韩欧美国产综合一区| 亚洲另类春色校园小说| 国产在线麻豆精品观看| 在线精品视频一区二区三四 | 日韩欧美美女一区二区三区| 亚洲人xxxx| 国产91丝袜在线观看| 制服丝袜亚洲播放| 一区二区三区不卡视频| 国产精品2024| 日韩欧美色电影| 亚洲国产一区在线观看| 成人的网站免费观看| 久久综合九色综合欧美就去吻| 亚洲成人黄色影院| 色女孩综合影院| 中文字幕中文字幕一区二区| 精品在线一区二区三区| 制服丝袜亚洲色图| 天天影视色香欲综合网老头| 色噜噜偷拍精品综合在线| 国产日韩欧美激情| 久久er99精品| 欧美tickling挠脚心丨vk| 天堂影院一区二区| 欧美视频精品在线观看| 一区二区三区在线播放| 91老师国产黑色丝袜在线| 国产精品入口麻豆原神| 成人性生交大合| 久久青草国产手机看片福利盒子| 青青草一区二区三区| 6080亚洲精品一区二区| 亚洲国产婷婷综合在线精品| 色噜噜夜夜夜综合网| 亚洲欧美日韩国产成人精品影院| 9色porny自拍视频一区二区| 国产精品网友自拍| 成人av在线资源网站| 国产精品麻豆欧美日韩ww| 成人晚上爱看视频| 国产精品久久久久精k8| proumb性欧美在线观看| 亚洲日本免费电影| 91麻豆.com| 亚洲一区二区三区视频在线播放| 欧洲一区二区av| 亚欧色一区w666天堂| 欧美精品丝袜久久久中文字幕| 日韩精品亚洲一区| 日韩欧美亚洲另类制服综合在线| 久久se这里有精品| 国产区在线观看成人精品| 99精品桃花视频在线观看| 亚洲精品国产无套在线观| 在线欧美一区二区| 婷婷国产v国产偷v亚洲高清| 欧美成人女星排名| 丁香婷婷综合激情五月色| 中文字幕一区二区三区在线不卡 | 欧美午夜片在线看| 青青草97国产精品免费观看| 久久伊人蜜桃av一区二区| 不卡一区二区中文字幕| 亚洲一区二区欧美日韩| 亚洲精品在线一区二区| 99re热视频精品| 另类专区欧美蜜桃臀第一页| 国产精品天干天干在观线|