-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
executable file
·54 lines (48 loc) · 1.24 KB
/
Copy pathtest.py
File metadata and controls
executable file
·54 lines (48 loc) · 1.24 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
51
52
53
54
import libartificial as ai
import numpy as np
import random
def comb_arrays(x):
#x is the list of arrays (for multivariate environment)
z = np.zeros((len(x[0][:]),len(x)))
for i in range(0,len(x)):
for j in range(0,len(x[0])):
z[j,i] = x[i][j]
return(z)
n = 1024
columns_X = 1
Xlist = []
Ylist = []
true_model = np.zeros((n,1))
for p in range(0, columns_X):
x = np.random.normal((random.randint(-100, 100)),(random.randint(1, 20)),size=(n,1))
Xlist.append(x)
true_model = true_model + x**2
error = np.random.normal(0,1,size=(n,1))
Y = true_model + error
Ylist.append(Y)
Y = comb_arrays(Ylist)
X = comb_arrays(Xlist)
variance = 0.01
epochs = 3
batch = 256
eta = 0.000001
hlayers = [1056, 552, 5450, 360, 230, 5405, 340, 593]
active_fnct = [
'logistic',
'tanh',
'gauss',
'softsign',
'softmax',
'softplus',
'tanh',
'logistic',
'linear'
]
X = ai.utils.normalize(X)
X = ai.utils.randomize(X)
wb = ai.utils.init_wb(variance, hlayers, active_fnct, 1, columns_X)
#wb = ai.utils.load_wb(hlayers, 1, columns_X)
feed = ai.neurons.ff(Y, X, wb, hlayers, active_fnct)
ai.training.update(Y, X, feed, wb, hlayers, active_fnct, batch, eta, epochs)
#ai.utils.save_wb(wb, hlayers, 1, columns_X)
ai.utils.freedom(feed, wb, len(hlayers))