-
Notifications
You must be signed in to change notification settings - Fork 97
Expand file tree
/
Copy pathtest_multi_layer_neural_network.jl
More file actions
29 lines (27 loc) Β· 1.03 KB
/
Copy pathtest_multi_layer_neural_network.jl
File metadata and controls
29 lines (27 loc) Β· 1.03 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
include("../src/multi_layer_neural_network.jl")
using BeautifulAlgorithms
using Test
@testset "Multi-layer neural network" begin
function test_two_layer_neural_network(π =[Ο])
x = 2
Ο = x -> [x, x^2, sqrt(abs(x))]
π = [[2,-1,3], [3,0,1]]
π° = [+1, -1]
π = [π, π°]
multi_layer_neural_network(x, π, Ο, π )
end
function test_five_layer_neural_network(π )
x = 2
Ο = x -> [x, x^2, sqrt(abs(x))]
πβ = [[2,-1,3], [3,0,1], [7,5,3]]
πβ = [[6,5,9], [3,3,3]]
πβ = [[6,5], [3,3], [3,3], [3,3], [3,3]]
πβ = [[1,2,3,4,5], [6,7,8,9,0]]
π° = [+1, -1]
π = [πβ, πβ, πβ, πβ, π°]
multi_layer_neural_network(x, π, Ο, π )
end
@test test_two_layer_neural_network([Ο]) β -0.013563772681566943
@test test_two_layer_neural_network([ReLU]) β -3.1715728752538093
@test test_five_layer_neural_network([Ο,Ο,Ο,Ο]) β -3.1668639943749355e-7
end