Advertisement
Guest User

Untitled

a guest
Dec 21st, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Lab 2
  2.  
  3. (def n3 (create-net [1 20 1] :bias true)) ; Создание сети
  4.  
  5. (def x (range -2.0 2.0 0.1))
  6.  
  7. (defn f [x]
  8.   (if (neg? x)
  9.     (* x (Math/sin (* 2 Math/PI x)))
  10.     (+ (* (- x) (Math/sin (* Math/PI x)))
  11.        (Math/exp (/ x 2))
  12.        (- (Math/exp 0)))))
  13.  
  14. (def train-set-approx (create-train-set f x))
  15.  
  16. (def n3t (training 0.1 0.3 :sigmoid train-set-approx 200 n3))
  17.  
  18. (view (xy-plot x (map f x)))
  19.  
  20. (def results-approx (vec (apply concat (test-results x (:current-s n3t)))))
  21.  
  22. (doto (scatter-plot x (map f x)
  23.                     :x-label "x"
  24.                     :y-label "y")
  25.       (add-points x results-approx)
  26.       view)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement