Advertisement
Guest User

Untitled

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