forked from CorticalComputer/DXNN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
derivatives.erl
78 lines (65 loc) · 1.67 KB
/
derivatives.erl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This source code and work is provided and developed by Gene I. Sher & DXNN Research Group WWW.DXNNResearch.COM
%
%Copyright (C) 2009 by Gene Sher, DXNN Research Group, CorticalComputer@gmail.com
%All rights reserved.
%
%This code is licensed under the version 3 of the GNU General Public License. Please see the LICENSE file that accompanies this project for the terms of use.
%%%%%%%%%%%%%%%%%%%% Deus Ex Neural Network :: DXNN %%%%%%%%%%%%%%%%%%%%
-module(derivatives).
-compile(export_all).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Activation Functions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tanh(Val)->%%%Derivative
TanH = math:tanh(Val),
1-math:pow(TanH,2).
cos(Val)->%%%Derivative
-math:sin(Val).
sin(Val)->%%%Derivative
math:cos(Val).
multiquadric(Val)->%%%Derivative
-0.5*math:pow(Val*Val+0.01,-1.5)*Val.
%linear(Val).
absolute(Val)->
case Val > 0 of
true ->
1;
false ->
-1
end.
linear(_Val)->%%%Derivative
1.
quadratic(Val)->%%%Derivative
functions:sgn(Val)*Val*2.
guassian(Val)->%%%Derivative
V = case Val > 10 of
true ->
10;
false ->
case Val < -10 of
true ->
-10;
false ->
Val
end
end,
math:pow(2.71828183,-V*V)*V*-2.
guassian1(Val)->%%%Derivative
V = case Val > 50 of
true ->
50;
false ->
case Val < -50 of
true ->
-50;
false ->
Val
end
end,
math:pow(2.71828183,-0.1*V*V)*-0.2*V.
sigmoid(Val)->%%%Derivative
Sigmoid = functions:sigmoid(Val),
Sigmoid*(1-Sigmoid).
sigmoid1(Val)->%%%Derivative
1/((1+abs(Val))*(1+abs(Val))).
test(Val)->
tanh(Val).