-
Notifications
You must be signed in to change notification settings - Fork 6
/
activation_functions_test.go
99 lines (77 loc) · 2.05 KB
/
activation_functions_test.go
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package cnns
import (
"testing"
)
const (
testFloat64 = 0.314
)
func TestActivationTanh(t *testing.T) {
correct := 0.30407166013575465
got := ActivationTanh(testFloat64)
if correct != got {
t.Errorf("Should be %f, but got %f", correct, got)
}
}
func TestActivationTanhDerivative(t *testing.T) {
correct := 0.9075404255022861
got := ActivationTanhDerivative(testFloat64)
if correct != got {
t.Errorf("Should be %f, but got %f", correct, got)
}
}
func TestActivationSygmoid(t *testing.T) {
correct := 0.5778613142807203
got := ActivationSygmoid(testFloat64)
if correct != got {
t.Errorf("Should be %f, but got %f", correct, got)
}
}
func TestActivationSygmoidDerivative(t *testing.T) {
correct := 0.2439376157384789
got := ActivationSygmoidDerivative(testFloat64)
if correct != got {
t.Errorf("Should be %f, but got %f", correct, got)
}
}
func TestActivationArcTan(t *testing.T) {
correct := 0.3042508322379845
got := ActivationArcTan(testFloat64)
if correct != got {
t.Errorf("Should be %f, but got %f", correct, got)
}
}
func TestActivationArcTanDerivative(t *testing.T) {
correct := 0.9102527225658933
got := ActivationArcTanDerivative(testFloat64)
if correct != got {
t.Errorf("Should be %f, but got %f", correct, got)
}
}
func TestActivationSoftPlus(t *testing.T) {
correct := 0.862421379790928
got := ActivationSoftPlus(testFloat64)
if correct != got {
t.Errorf("Should be %f, but got %f", correct, got)
}
}
func TestActivationSoftPlusDerivative(t *testing.T) {
correct := 0.5778613142807203
got := ActivationSoftPlusDerivative(testFloat64)
if correct != got {
t.Errorf("Should be %f, but got %f", correct, got)
}
}
func TestActivationGaussian(t *testing.T) {
correct := 0.9061087020033959
got := ActivationGaussian(testFloat64)
if correct != got {
t.Errorf("Should be %f, but got %f", correct, got)
}
}
func TestActivationGaussianDerivative(t *testing.T) {
correct := -0.5690362648581326
got := ActivationGaussianDerivative(testFloat64)
if correct != got {
t.Errorf("Should be %f, but got %f", correct, got)
}
}