Advertisement
Guest User

Untitled

a guest
Dec 21st, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Lab 1
  2. (def n2 (create-net [2 1] :bias true)) ; Создание сети с одним нейроном и двумя входами
  3.  
  4. (def train-set-and
  5.   [[[0 0] [0]] [[0 1] [0]]
  6.    [[1 0] [0]] [[1 1] [1]]])
  7.  
  8. (def train-set-or
  9.   [[[0 0] [0]] [[0 1] [1]]
  10.    [[1 0] [1]] [[1 1] [1]]])
  11.  
  12. (def train-set-vecs
  13.   [[[0.2 0.1] [0]] [[0.3 0.2] [0]]
  14.    [[0.9 0.6] [1]] [[0.9 0.8] [1]]])
  15.  
  16. ; And
  17. (def n2t (training 0.7 0.9 :sigmoid train-set-and 150 n2))
  18.  
  19. (def errors (reverse (:errors n2t)))
  20.  
  21. (def results (vec (apply concat (test-results (map first train-set-and) (:current-s n2t)))))
  22.  
  23. (view (function-plot (partial nth errors) 0 (dec (count errors-or))))
  24.  
  25. ; Or
  26. (def n2t-or (training 0.7 0.9 :sigmoid train-set-or 150 n2))
  27.  
  28. (def errors-or (reverse (:errors n2t-or)))
  29.  
  30. (def results-or (vec (apply concat (test-results (map first train-set-or) (:current-s n2t-or)))))
  31.  
  32. (view (function-plot (partial nth errors-or) 0 (dec (count errors-or))))
  33.  
  34. ; Vecs
  35. (def n2t-vecs (training 0.7 0.9 :sigmoid train-set-vecs 150 n2))
  36.  
  37. (def errors-vecs (reverse (:errors n2t-vecs)))
  38.  
  39. (def results-vecs (vec (apply concat (test-results (map first train-set-vecs) (:current-s n2t-vecs)))))
  40.  
  41. (view (function-plot (partial nth errors-vecs) 0 (dec (count errors-vecs))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement