nnfunctions.txt
来自「NN Functions a program in Lisp to demon」· 文本 代码 · 共 39 行
TXT
39 行
/*Aim:- Write a program in Lisp to demonstrate working of an artificial neuron. (Enter an input vector X and weight vector W. Calculate weighted sum XW. Transform this using signal or activation functions like logistic, threshold, hyperbolic-tangent, linear, exponential, sigmoid or some other functions (syntax provided) and display the output). */
(defun nnFunctions (actSignList wghtList c n)
(setq wghtSum 0)
(setq resFunc 0)
(loop
(when (equal (first actSignList) nil) (return))
(setq wghtSum (+ wghtSum (* (first actSignList) (first wghtList))))
(print wghtSum )
(setq actSignList (rest actSignList))
(setq wghtList (rest wghtList))
)
(print "Logistical Signal Function")
(print (/ 1 (+ 1 (exp (- 0 (* c wghtSum))))))
(print "Hyperbolic tangent Signal Function")
(print (tan (* 10 wghtSum)))
(print "Threshold Linear Signal Function")
(if (<= 1 (* c wghtSum)) (print 1) (print 0))
(print "Linear Signal Function")
(print (* c wghtSum))
(print "Threshold Exponential Signal Function")
(print (min 1 (exp (* c wghtSum))))
(print "Threshold Distribution Signal Function")
(print (max 0 (- 1 (exp (- 0 (* c wghtSum))))))
(print "Ratio Polynomial Signal Function")
(print (max 0 (/ (expt wghtSum n) (+ c (expt wghtSum n)))))
)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?