Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Lab 1
- (def n2 (create-net [2 1] :bias true)) ; Создание сети с одним нейроном и двумя входами
- (def train-set-and
- [[[0 0] [0]] [[0 1] [0]]
- [[1 0] [0]] [[1 1] [1]]])
- (def train-set-or
- [[[0 0] [0]] [[0 1] [1]]
- [[1 0] [1]] [[1 1] [1]]])
- (def train-set-vecs
- [[[0.2 0.1] [0]] [[0.3 0.2] [0]]
- [[0.9 0.6] [1]] [[0.9 0.8] [1]]])
- ; And
- (def n2t (training 0.7 0.9 :sigmoid train-set-and 150 n2))
- (def errors (reverse (:errors n2t)))
- (def results (vec (apply concat (test-results (map first train-set-and) (:current-s n2t)))))
- (view (function-plot (partial nth errors) 0 (dec (count errors-or))))
- ; Or
- (def n2t-or (training 0.7 0.9 :sigmoid train-set-or 150 n2))
- (def errors-or (reverse (:errors n2t-or)))
- (def results-or (vec (apply concat (test-results (map first train-set-or) (:current-s n2t-or)))))
- (view (function-plot (partial nth errors-or) 0 (dec (count errors-or))))
- ; Vecs
- (def n2t-vecs (training 0.7 0.9 :sigmoid train-set-vecs 150 n2))
- (def errors-vecs (reverse (:errors n2t-vecs)))
- (def results-vecs (vec (apply concat (test-results (map first train-set-vecs) (:current-s n2t-vecs)))))
- (view (function-plot (partial nth errors-vecs) 0 (dec (count errors-vecs))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement