forked from Seqaeon/EMNIST_streamlit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharchitectures.py
113 lines (53 loc) · 3.22 KB
/
architectures.py
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
############################################################ Random connection (MNIST original) #################################################################
import ao_arch as ar
description = "Basic MNIST"
arch_i = [8 for i in range(28 * 28)]
arch_z = [4]
arch_c = []
connector_function = "rand_conn"
# used 360, 180 before to good success
connector_parameters = [392, 261, 784, 4]
arch = ar.Arch(
arch_i, arch_z, arch_c, connector_function, connector_parameters, description
)
############################################################ Nearest neighbour connection (4,4) #################################################################
import ao_arch as ar
neurons_x = 28 # Number of neurons in the x direction (global variable)
neurons_y = 28 # Number of neurons in the y direction
description = "nearest_neighbour MNIST" # Description of the agent
# Initialize the input and output architecture with 4 neurons per channel
arch_i = [8 for i in range(28 * 28)]
arch_z = [4]
arch_c = []
connector_function = "nearest_neighbour_conn" # Function for connecting neurons
Z2I_connections = True #wether want Z to I connection or not. If not specified, by default it's False.
# if Z and Q both have different sizes, only then define below variables
z21_random = False
connector_parameters = [4, 4, neurons_x, neurons_y, Z2I_connections, z21_random] #ax, dg, neurons_x, neurons_y and Z2I connection (True or default False)
# Create the architecture using the Arch class from the ao_arch library
arcArch = ar.Arch(arch_i, arch_z, arch_c, connector_function, connector_parameters, description)
############################################################ Nearest neighbour connection (7,7) #################################################################
import ao_arch as ar
neurons_x = 28 # Number of neurons in the x direction (global variable)
neurons_y = 28 # Number of neurons in the y direction
description = "nearest_neighbour MNIST" # Description of the agent
# Initialize the input and output architecture with 4 neurons per channel
arch_i = [8 for i in range(28 * 28)]
arch_z = [4]
arch_c = []
connector_function = "nearest_neighbour_conn" # Function for connecting neurons
Z2I_connections = True #wether want Z to I connection or not. If not specified, by default it's False.
# if Z and Q both have different sizes, only then define below variables
z21_random = False
connector_parameters = [7, 7, neurons_x, neurons_y, Z2I_connections, z21_random] #ax, dg, neurons_x, neurons_y and Z2I connection (True or default False)
# Create the architecture using the Arch class from the ao_arch library
arcArch = ar.Arch(arch_i, arch_z, arch_c, connector_function, connector_parameters, description)
############################################################ Full connection #################################################################
import ao_arch as ar
# Initialize the input and output architecture with 4 neurons per channel
arch_i = [8 for i in range(28 * 28)]
arch_z = [4]
arch_c = []
connector_function = "full_conn" # Function for connecting neurons
# Create the architecture using the Arch class from the ao_arch library
arcArch = ar.Arch(arch_i, arch_z, arch_c, connector_function, description)