📄 nnfunctions.txt
字号:
/*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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -