Facebook
From daaawitttt, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 260
  1. clear all
  2. close all
  3. clc
  4.  
  5. I= [-1,-1,-1,-1,-1,-1;
  6.     -1,-1,+1,+1,+1,-1;
  7.     -1,-1,-1,+1,-1,-1;
  8.     -1,-1,-1,+1,-1,-1;
  9.     -1,-1,-1,+1,-1,-1;
  10.     -1,-1,-1,+1,-1,-1;
  11.     -1,-1,+1,+1,+1,-1;
  12.     -1,-1,-1,-1,-1,-1]
  13.  
  14. figure(1)
  15. hintonw(I)
  16.  
  17. J= [-1,-1,-1,-1,-1,-1;
  18.     -1,+1,+1,+1,+1,-1;
  19.     -1,-1,-1,-1,+1,-1;
  20.     -1,-1,-1,-1,+1,-1;
  21.     -1,-1,-1,-1,+1,-1;
  22.     -1,+1,-1,-1,+1,-1;
  23.     -1,-1,+1,+1,-1,-1;
  24.     -1,-1,-1,-1,-1,-1]
  25.  
  26. figure(2)
  27. hintonw(J)
  28.  
  29. K= [-1,-1,-1,-1,-1,-1;
  30.     -1,+1,-1,-1,+1,-1;
  31.     -1,+1,-1,+1,-1,-1;
  32.     -1,+1,+1,-1,-1,-1;
  33.     -1,+1,+1,-1,-1,-1;
  34.     -1,+1,-1,+1,-1,-1;
  35.     -1,+1,-1,-1,+1,-1;
  36.     -1,-1,-1,-1,-1,-1]
  37.  
  38. figure(3)
  39. hintonw(K)
  40.  
  41. L= [-1,-1,-1,-1,-1,-1;
  42.     -1,+1,-1,-1,-1,-1;
  43.     -1,+1,-1,-1,-1,-1;
  44.     -1,+1,-1,-1,-1,-1;
  45.     -1,+1,-1,-1,-1,-1;
  46.     -1,+1,-1,-1,-1,-1;
  47.     -1,+1,+1,+1,+1,-1;
  48.     -1,-1,-1,-1,-1,-1]
  49.  
  50. figure(4)
  51. hintonw(L)
  52.  
  53. L1 = reshape (I,48,1)
  54. L2 = reshape (J,48,1)
  55. L3 = reshape (K,48,1)
  56. L4 = reshape (L,48,1)
  57.  
  58. P = [L1,L2,L3,L4]
  59.  
  60. whos
  61. disp(P)
  62. T=eye(4)
  63.  
  64. net=newp(P,T,'hardlim','learnp')
  65.  
  66. net.trainParam.epochs = 50;
  67. net=train(net,P,T)
  68.  
  69. disp('Rozmiar macieżrzy wag: ')
  70. disp(net.IW)
  71. disp('Zawarosc macierzy wag')
  72. disp(net.IW{1})
  73. disp('Rozmiar wektora wsp. progowych')
  74. disp(net.b)
  75. disp('Zawartosc wektowa wsp. progowych')
  76. disp(net.b{1})
  77.  
  78. y=sim(net,P)
  79.  
  80. figure(5)
  81. for i=1:4
  82.     subplot(1,2,1)
  83.     hintonw(reshape(P(:,i),8,6))
  84.     subplot(1,2,2)
  85.     hintonw(Y(:,i))
  86.     pause()
  87. end