]> gitweb.factorcode.org Git - factor.git/blob - extra/machine-learning/functions/functions-tests.factor
714f82e992eb4fd43a3fa8d124e5dc04a7a29fde
[factor.git] / extra / machine-learning / functions / functions-tests.factor
1 ! Copyright (C) 2017 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: tools.test machine-learning.functions ;
4 IN: machine-learning.functions.tests
5
6 { 0 } [ 0 relu ] unit-test
7 { .5 .000001 } [ .5 relu ] unit-test~
8 { 1 } [ 1 relu ] unit-test
9 { 0 } [ -.5 relu ] unit-test
10 { 0 } [ -1 relu ] unit-test
11
12 { 0 } [ -1 relu6 ] unit-test
13 { 6 } [ 10 relu6 ] unit-test
14
15 { -.01 .00001 } [ -1 .01 leaky-relu ] unit-test~
16 { 0 } [ 0 .01 leaky-relu ] unit-test
17 { .5 .000001 } [ .5 .01 leaky-relu ] unit-test~
18 { 1 } [ 1 .01 leaky-relu ] unit-test
19 { -.005 .1 } [ -.5 .01 leaky-relu ] unit-test~
20
21 { 0 } [ 0 default-leaky-relu ] unit-test
22 { 1 } [ 1 default-leaky-relu ] unit-test
23 { .5 .000001 } [ .5 default-leaky-relu ] unit-test~
24 { -.005 .1 } [ -.5 default-leaky-relu ] unit-test~
25
26 {
27     {
28         0.327201948676532
29         0.1203708700293295
30         0.04428196839971006
31         0.0162904257888568
32         0.327201948676532
33         0.1203708700293295
34         0.04428196839971006
35     } .00001
36 } [ { 1. 2. 3. 4. 1. 2. 3. } softmin ] unit-test-v~
37
38 {
39     {
40         0.02364054302159138
41         0.06426165851049616
42         0.1746812985957223
43         0.4748329997443803
44         0.02364054302159138
45         0.06426165851049616
46         0.1746812985957223
47     } .00001
48 } [ { 1. 2. 3. 4. 1. 2. 3. } softmax ] unit-test-v~
49
50 {
51     {
52         -7.463073944710613
53         -12.13384821518222
54         -24.83032903943923
55         -59.3429421493958
56         -7.463073944710613
57         -12.13384821518222
58         -24.83032903943923
59     } .00001
60 } [ { 1. 2. 3. 4. 1. 2. 3. } log-softmax ] unit-test-v~