-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
33 lines (22 loc) · 732 Bytes
/
run.py
File metadata and controls
33 lines (22 loc) · 732 Bytes
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
import np_nn
import numpy as np
data = np.loadtxt("sklearn_digits.csv", delimiter = ",")
y = data[:,0:10]
data = data[:,10:]
data -= data.min()
data /= data.max()
x = []
for i in range(data.shape[0]):
z = list((data[i,:].tolist(), y[i].tolist()))
x.append(z)
np.random.seed(2)
my_nn = np_nn.NeuralNetwork(64, 300, 10, learning_rate=0.001, momentum = 0.05, rate_dacay = 0.001, activation_fun = "softmax")
#data = [[[1, 0, 1], [1, 0, 0]],
# [[0, 1, 0], [1, 0, 0]],
# [[1, 1, 1], [0, 0, 1]],
# [[0, 0, 0], [0, 0, 1]]]
#inputs = [[1, 0, 1], [0, 1, 0], [1, 1, 1], [0, 0, 0]]
#print(my_nn.predict(x[0][0]))
my_nn.train(x, iterations = 10, verbose = True)
print(my_nn.predict([x[0][0]]))
print(x[0][1])