-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.py
55 lines (43 loc) · 1.51 KB
/
model.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
from aaaa import Cerebellum as cb
import numpy as np
import matplotlib.pyplot as plt
hist = np.zeros((300, 16))
cell_group_1 = cb.Cell(4, 4, 4, 2, 2)
cell_group_2 = cb.Cell(4, 8, 4, 2, 2)
cell_group_3 = cb.Cell(4, 8, 4, 2, 2)
cell_group_4 = cb.Cell(4, 8, 4, 2, 2)
# cg1_in = np.concatenate([np.full((100, 4), 0), np.full((100, 4), 1), np.full((100, 4), 0)], axis=0)
cg1_in = np.full((300, 4), 0)
cg1_in[100:200, 0:2] = 1
cg1_in[50:150, 2:4] = 1
print(np.sum(cg1_in))
cg2_e_in = np.zeros(8)
cg3_e_in = np.zeros(8)
cg3_i_in = np.zeros(4)
cg4_e_in = np.zeros(8)
for ii in range(300):
cg2_e_in[0:4] = cell_group_1.cell_output
cg2_e_in[4:8] = cell_group_3.cell_output
cg3_e_in[0:4] = cell_group_1.cell_output
cg3_e_in[4:8] = cell_group_2.cell_output
cg3_i_in = cell_group_2.cell_output*0.5
cg4_e_in[0:4] = cell_group_2.cell_output
cg4_e_in[4:8] = cell_group_4.cell_output
print(cg1_in[ii])
cell_group_1.update(cg1_in[ii], np.zeros(4), learning=True)
cell_group_2.update(cg2_e_in, np.zeros(4), learning=True)
cell_group_3.update(cg3_e_in, cg3_i_in, learning=True)
cell_group_4.update(cg4_e_in, np.zeros(4), learning=True)
hist[ii][:4] = cell_group_1.cell_output
hist[ii][4:8] = cell_group_2.cell_output
hist[ii][8:12] = cell_group_3.cell_output
hist[ii][12:] = cell_group_4.cell_output
plt.subplot(1, 4, 1)
plt.plot(hist[:, :4])
plt.subplot(1, 4, 2)
plt.plot(hist[:, 4:8])
plt.subplot(1, 4, 3)
plt.plot(hist[:, 8:12])
plt.subplot(1, 4, 4)
plt.plot(hist[:, 12:])
plt.show()