-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrorfunction_test.go
More file actions
50 lines (41 loc) · 1.21 KB
/
errorfunction_test.go
File metadata and controls
50 lines (41 loc) · 1.21 KB
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
package gorpropplus
import (
"testing"
)
func TestSSE(t *testing.T) {
nnResult := 0.002113682991
expected := 0.0
nnError := SSE(nnResult, expected)
correctNNerror := 0.000002233827893
if toFixed(nnError, 6) != toFixed(correctNNerror, 6) {
t.Fatalf("Error: the nnError is %f instead of %f", nnError, correctNNerror)
}
}
func TestDerivateSSE(t *testing.T) {
nnResult := 0.0001307631303
expected := 0.0
nnError := DerivateSSE(nnResult, expected)
correctNNerror := 0.0001307631303
if nnError != correctNNerror {
t.Fatalf("Error: the derivate nnError is %f instead of %f", nnError, correctNNerror)
}
}
func TestCE(t *testing.T) {
nnResult := 0.00004911231579
expected := 0.0
nnError := CE(nnResult, expected)
correctNNerror := 0.00004911352184
if toFixed(nnError, 6) != toFixed(correctNNerror, 6) {
t.Fatalf("Error: the nnError is %f instead of %f", nnError, correctNNerror)
}
}
// This test is a WIP.
// func TestDerivateCE(t *testing.T) {
// nnResult := 0.00000467802729
// expected := 0.0
// nnError := DerivateCE(nnResult, expected)
// correctNNerror := 0.00000467802729
// if nnError != correctNNerror {
// t.Fatalf("Error: the derivate nnError is %f instead of %f", nnError, correctNNerror)
// }
// }